zx 1 mês atrás
commit
8e6b2a9670
100 arquivos alterados com 9979 adições e 0 exclusões
  1. 56 0
      .gitignore
  2. 36 0
      README.en.md
  3. 37 0
      README.md
  4. 141 0
      fs-ad-api/pom.xml
  5. 14 0
      fs-ad-api/src/main/java/com/fs/FSServletInitializer.java
  6. 25 0
      fs-ad-api/src/main/java/com/fs/FsAdApiApplication.java
  7. 12 0
      fs-ad-api/src/main/java/com/fs/app/annotation/Login.java
  8. 15 0
      fs-ad-api/src/main/java/com/fs/app/annotation/LoginUser.java
  9. 120 0
      fs-ad-api/src/main/java/com/fs/app/controller/AdCallbackController.java
  10. 38 0
      fs-ad-api/src/main/java/com/fs/app/controller/CommonController.java
  11. 215 0
      fs-ad-api/src/main/java/com/fs/app/controller/MockAppController.java
  12. 51 0
      fs-ad-api/src/main/java/com/fs/app/exception/FSException.java
  13. 81 0
      fs-ad-api/src/main/java/com/fs/app/exception/FSExceptionHandler.java
  14. 31 0
      fs-ad-api/src/main/java/com/fs/app/mq/RocketMQAiMsgService.java
  15. 30 0
      fs-ad-api/src/main/java/com/fs/app/mq/RocketMQConsumerService.java
  16. 26 0
      fs-ad-api/src/main/java/com/fs/app/mq/RocketMQConsumerServiceByQw.java
  17. 34 0
      fs-ad-api/src/main/java/com/fs/app/task/Task.java
  18. 182 0
      fs-ad-api/src/main/java/com/fs/framework/aspectj/DataScopeAspect.java
  19. 73 0
      fs-ad-api/src/main/java/com/fs/framework/aspectj/DataSourceAspect.java
  20. 245 0
      fs-ad-api/src/main/java/com/fs/framework/aspectj/LogAspect.java
  21. 117 0
      fs-ad-api/src/main/java/com/fs/framework/aspectj/RateLimiterAspect.java
  22. 31 0
      fs-ad-api/src/main/java/com/fs/framework/config/ApplicationConfig.java
  23. 85 0
      fs-ad-api/src/main/java/com/fs/framework/config/CaptchaConfig.java
  24. 100 0
      fs-ad-api/src/main/java/com/fs/framework/config/DataSourceConfig.java
  25. 123 0
      fs-ad-api/src/main/java/com/fs/framework/config/DruidConfig.java
  26. 72 0
      fs-ad-api/src/main/java/com/fs/framework/config/FastJson2JsonRedisSerializer.java
  27. 59 0
      fs-ad-api/src/main/java/com/fs/framework/config/FilterConfig.java
  28. 76 0
      fs-ad-api/src/main/java/com/fs/framework/config/KaptchaTextCreator.java
  29. 150 0
      fs-ad-api/src/main/java/com/fs/framework/config/MyBatisConfig.java
  30. 121 0
      fs-ad-api/src/main/java/com/fs/framework/config/RedisConfig.java
  31. 65 0
      fs-ad-api/src/main/java/com/fs/framework/config/ResourcesConfig.java
  32. 50 0
      fs-ad-api/src/main/java/com/fs/framework/config/SecurityConfig.java
  33. 33 0
      fs-ad-api/src/main/java/com/fs/framework/config/ServerConfig.java
  34. 121 0
      fs-ad-api/src/main/java/com/fs/framework/config/SwaggerConfig.java
  35. 63 0
      fs-ad-api/src/main/java/com/fs/framework/config/ThreadPoolConfig.java
  36. 77 0
      fs-ad-api/src/main/java/com/fs/framework/config/properties/DruidProperties.java
  37. 27 0
      fs-ad-api/src/main/java/com/fs/framework/datasource/DynamicDataSource.java
  38. 45 0
      fs-ad-api/src/main/java/com/fs/framework/datasource/DynamicDataSourceContextHolder.java
  39. 56 0
      fs-ad-api/src/main/java/com/fs/framework/interceptor/RepeatSubmitInterceptor.java
  40. 126 0
      fs-ad-api/src/main/java/com/fs/framework/interceptor/impl/SameUrlDataInterceptor.java
  41. 56 0
      fs-ad-api/src/main/java/com/fs/framework/manager/AsyncManager.java
  42. 40 0
      fs-ad-api/src/main/java/com/fs/framework/manager/ShutdownManager.java
  43. 103 0
      fs-ad-api/src/main/java/com/fs/framework/manager/factory/AsyncFactory.java
  44. 1 0
      fs-ad-api/src/main/resources/META-INF/spring-devtools.properties
  45. 127 0
      fs-ad-api/src/main/resources/application-dev.yml
  46. 80 0
      fs-ad-api/src/main/resources/application-druid.yml
  47. 131 0
      fs-ad-api/src/main/resources/application.yml
  48. 2 0
      fs-ad-api/src/main/resources/banner.txt
  49. 37 0
      fs-ad-api/src/main/resources/i18n/messages.properties
  50. 15 0
      fs-ad-api/src/main/resources/mybatis/mybatis-config.xml
  51. 203 0
      fs-admin/pom.xml
  52. 36 0
      fs-admin/src/main/java/com/fs/FSAdminApplication.java
  53. 16 0
      fs-admin/src/main/java/com/fs/FSServletInitializer.java
  54. 29 0
      fs-admin/src/main/java/com/fs/ad/controller/AdAccountController.java
  55. 106 0
      fs-admin/src/main/java/com/fs/ad/controller/AdDomainController.java
  56. 97 0
      fs-admin/src/main/java/com/fs/ad/controller/AdHtmlClickLogController.java
  57. 103 0
      fs-admin/src/main/java/com/fs/ad/controller/AdHtmlTemplateController.java
  58. 106 0
      fs-admin/src/main/java/com/fs/ad/controller/AdIqiyiAccountController.java
  59. 98 0
      fs-admin/src/main/java/com/fs/ad/controller/AdSiteController.java
  60. 106 0
      fs-admin/src/main/java/com/fs/ad/controller/AdYoukuAccountController.java
  61. 141 0
      fs-admin/src/main/java/com/fs/ad/controller/BdAccountController.java
  62. 215 0
      fs-admin/src/main/java/com/fs/ad/controller/MockAppController.java
  63. 84 0
      fs-admin/src/main/java/com/fs/ad/controller/StatisticsController.java
  64. 32 0
      fs-admin/src/main/java/com/fs/ad/controller/task/BaiduTask.java
  65. 71 0
      fs-admin/src/main/java/com/fs/api/controller/CompanyAPIController.java
  66. 175 0
      fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java
  67. 258 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyController.java
  68. 158 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyDeductController.java
  69. 112 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyDeptController.java
  70. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyLogininforController.java
  71. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyMenuController.java
  72. 147 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyMoneyLogsController.java
  73. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyOperLogController.java
  74. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyPostController.java
  75. 285 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyProfitController.java
  76. 150 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyRechargeController.java
  77. 128 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyRedPackageLogsController.java
  78. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyRoleController.java
  79. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyRoleDeptController.java
  80. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyRoleMenuController.java
  81. 134 0
      fs-admin/src/main/java/com/fs/company/controller/CompanySmsController.java
  82. 124 0
      fs-admin/src/main/java/com/fs/company/controller/CompanySmsLogsController.java
  83. 106 0
      fs-admin/src/main/java/com/fs/company/controller/CompanySmsOrderController.java
  84. 114 0
      fs-admin/src/main/java/com/fs/company/controller/CompanySmsPackageController.java
  85. 122 0
      fs-admin/src/main/java/com/fs/company/controller/CompanySmsTempController.java
  86. 246 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyStatisticsController.java
  87. 261 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyTcmReportController.java
  88. 130 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyTcmScheduleController.java
  89. 142 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyUserController.java
  90. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyUserPostController.java
  91. 103 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyUserRoleController.java
  92. 106 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceApiController.java
  93. 111 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceBlacklistController.java
  94. 153 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java
  95. 175 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceConfigController.java
  96. 134 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceController.java
  97. 133 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceLogsController.java
  98. 134 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceMobileController.java
  99. 114 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoicePackageController.java
  100. 106 0
      fs-admin/src/main/java/com/fs/company/controller/CompanyVoicePackageOrderController.java

+ 56 - 0
.gitignore

@@ -0,0 +1,56 @@
+# Compiled class file
+
+target/
+#resources/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+#*.yml
+logback.xml
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+*.DS_Store
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+
+#1.配置语法: 以斜杠“/”开头表示目录: 以星号“*”通配多个字符: 以问号“?”通配单个字符 以方括号“[]”包含单个字符的匹配列表: 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录:
+#此外,git 对于 .ignore 配置文件是按行从上到下进行规则匹配的,意味着如果前面的规则匹配的范围更大,则后面的规则将不会生效

+ 36 - 0
README.en.md

@@ -0,0 +1,36 @@
+# yunl_java
+
+#### Description
+yunl_java
+
+#### Software Architecture
+Software architecture description
+
+#### Installation
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Instructions
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Contribution
+
+1.  Fork the repository
+2.  Create Feat_xxx branch
+3.  Commit your code
+4.  Create Pull Request
+
+
+#### Gitee Feature
+
+1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
+2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
+3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
+4.  The most valuable open source project [GVP](https://gitee.com/gvp)
+5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
+6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 37 - 0
README.md

@@ -0,0 +1,37 @@
+# yunl_java
+
+#### 介绍
+yunl_java
+
+#### 软件架构
+软件架构说明
+
+
+#### 安装教程
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### 使用说明
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### 参与贡献
+
+1.  Fork 本仓库
+2.  新建 Feat_xxx 分支
+3.  提交代码
+4.  新建 Pull Request
+
+
+#### 特技
+
+1.  使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
+2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
+3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
+4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
+5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
+6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 141 - 0
fs-ad-api/pom.xml

@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+    <parent>
+        <artifactId>fs</artifactId>
+        <groupId>com.fs</groupId>
+        <version>1.1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>fs-ad-api</artifactId>
+    <description>
+       投流接口
+    </description>
+    <dependencies>
+
+        <!-- spring-boot-devtools -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional> <!-- 表示依赖不会传递 -->
+        </dependency>
+        <!-- swagger2-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+        </dependency>
+
+        <!-- swagger2-UI-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>swagger-bootstrap-ui</artifactId>
+            <version>1.9.3</version>
+        </dependency>
+
+
+        <!-- Mysql驱动包 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <!-- SpringBoot Web容器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <!-- SpringBoot 拦截器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+
+        <!-- 阿里数据库连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- 验证码 -->
+        <dependency>
+            <groupId>com.github.penggle</groupId>
+            <artifactId>kaptcha</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>javax.servlet-api</artifactId>
+                    <groupId>javax.servlet</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- 获取系统信息 -->
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fs</groupId>
+            <artifactId>fs-service-system</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.tencentyun</groupId>
+            <artifactId>tls-sig-api-v2</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-websocket</artifactId>
+            <version>5.1.10.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-spring-boot-starter</artifactId>
+            <version>2.2.3</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <configuration>
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                    <warName>${project.artifactId}</warName>
+                </configuration>
+            </plugin>
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

+ 14 - 0
fs-ad-api/src/main/java/com/fs/FSServletInitializer.java

@@ -0,0 +1,14 @@
+package com.fs;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+
+public class FSServletInitializer extends SpringBootServletInitializer
+{
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
+    {
+        return application.sources(FsAdApiApplication.class);
+    }
+}

+ 25 - 0
fs-ad-api/src/main/java/com/fs/FsAdApiApplication.java

@@ -0,0 +1,25 @@
+package com.fs;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * 启动程序
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@EnableTransactionManagement
+@EnableAsync
+@EnableScheduling
+public class FsAdApiApplication
+{
+    public static void main(String[] args)
+    {
+        // System.setProperty("spring.devtools.restart.enabled", "false");
+        SpringApplication.run(FsAdApiApplication.class, args);
+        System.out.println("ad-api启动成功");
+    }
+}

+ 12 - 0
fs-ad-api/src/main/java/com/fs/app/annotation/Login.java

@@ -0,0 +1,12 @@
+package com.fs.app.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * app登录效验
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Login {
+}

+ 15 - 0
fs-ad-api/src/main/java/com/fs/app/annotation/LoginUser.java

@@ -0,0 +1,15 @@
+package com.fs.app.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 登录用户信息
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LoginUser {
+
+}

+ 120 - 0
fs-ad-api/src/main/java/com/fs/app/controller/AdCallbackController.java

@@ -0,0 +1,120 @@
+package com.fs.app.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fs.ad.domain.AdHtmlTemplate;
+import com.fs.ad.domain.AdSite;
+import com.fs.ad.mapper.AdHtmlTemplateMapper;
+import com.fs.ad.service.IAdAccountService;
+import com.fs.ad.service.IAdHtmlClickLogService;
+import com.fs.ad.service.IAdSiteService;
+import com.fs.baidu.api.BaiduApis;
+import com.fs.baidu.service.IBdAccountService;
+import com.fs.baidu.vo.ad.AdBaiduClickCallbackVo;
+import com.fs.baidu.vo.AdClickCallbackVo;
+import com.fs.baidu.vo.ad.AdIqiyiClickCallbackVo;
+import com.fs.baidu.vo.ad.AdYouKuClickCallbackVo;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.StringUtils;
+import com.fs.qw.domain.QwWorkLink;
+import com.fs.qw.service.IQwWorkLinkService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 知识库Controller
+ *
+ * @author fs
+ * @date 2024-04-21
+ */
+@Slf4j
+@AllArgsConstructor
+@RestController
+@RequestMapping("/baidu")
+public class AdCallbackController extends BaseController {
+
+    private final AdHtmlTemplateMapper adHtmlTemplateMapper;
+    private final IAdHtmlClickLogService adHtmlClickLogService;
+    private final BaiduApis baiduApis;
+    private final IBdAccountService bdAccountService;
+    private final IAdSiteService adSiteService;
+    private final IAdAccountService adAccountService;
+    private final IQwWorkLinkService qwWorkLinkService;
+
+    //百度-页面点击接口
+//    @GetMapping("/callback")
+//    public R callback(String url, String bdVid, String t, Long id) {
+//        if(id == null || StringUtils.isEmpty(bdVid)) {
+//            return R.ok();
+//        }
+//        adHtmlClickLogService.addLog(url, id, bdVid, t);
+//        return R.ok();
+//    }
+    // 百度点击监听返回接口
+//    @GetMapping("/clickCallback")
+//    public R clickCallback(AdClickCallbackVo vo){
+//        log.info("百度监听地址返回数据:{}", JSON.toJSONString(vo));
+//        adHtmlClickLogService.setLogBaiDu(vo, "67", 0);
+//        return R.ok();
+//    }
+    @GetMapping("/getTemplateByNo")
+    public R getTemplateByNo(String no){
+        AdHtmlTemplate htmlUrl = adHtmlTemplateMapper.selectOne(new QueryWrapper<AdHtmlTemplate>().eq("no", no));
+        if(htmlUrl == null){
+            return R.error("错误编号");
+        }
+        return R.ok().put("data",  htmlUrl);
+    }
+    @GetMapping("/getTemplateById")
+    public R getTemplateById(Long id){
+        AdSite site = adSiteService.getById(id);
+        if(site.getWorkId() != null){
+            QwWorkLink byId = qwWorkLinkService.getById(site.getWorkId());
+            if(byId != null){
+                site.setWorkUrl(byId.getUrl());
+            }
+        }
+        AdHtmlTemplate htmlUrl = adHtmlTemplateMapper.selectById(site.getTemplateId());
+        if(htmlUrl == null){
+            return R.error("错误编号");
+        }
+        return R.ok().put("site", site).put("data",  htmlUrl);
+    }
+//    @GetMapping("/syncPlan")
+//    public R syncPlan(){
+//        baiduApis.listAccount(1L);
+//        return R.ok();
+//    }
+
+
+    @GetMapping("/baiduClickCallbackApi")
+    public R baiduClickCallbackApi(AdBaiduClickCallbackVo vo){
+        log.info("百度点击监听地址返回数据:{}", JSON.toJSONString(vo));
+        adHtmlClickLogService.setLogBaiDuApi(vo);
+        return R.ok();
+    }
+    @GetMapping("/baiduClickCallback")
+    public R baiduClickCallback(AdBaiduClickCallbackVo vo){
+        log.info("百度监听地址返回数据:{}", JSON.toJSONString(vo));
+        adHtmlClickLogService.setLogBaiDu(vo);
+        return R.ok();
+    }
+    @GetMapping("/youkuClickCallback")
+    public R youkuClickCallback(AdYouKuClickCallbackVo vo){
+        log.info("优酷监听地址返回数据:{}", JSON.toJSONString(vo));
+        adHtmlClickLogService.setLogYouKu(vo);
+        return R.ok();
+    }
+    @GetMapping("/iqiyiClickCallback")
+    public R iqiyiClickCallback(AdIqiyiClickCallbackVo vo){
+        log.info("爱奇艺监听地址返回数据:{}", JSON.toJSONString(vo));
+        adHtmlClickLogService.setLogIqiyi(vo);
+        return R.ok();
+    }
+
+
+}

+ 38 - 0
fs-ad-api/src/main/java/com/fs/app/controller/CommonController.java

@@ -0,0 +1,38 @@
+package com.fs.app.controller;
+
+
+import com.alibaba.fastjson.JSON;
+import com.fs.ad.enums.AdUploadType;
+import com.fs.ad.service.IAdHtmlClickLogService;
+import com.fs.common.core.domain.R;
+import com.fs.qw.vo.AdUploadVo;
+import com.fs.wxUser.service.ICompanyWxUserService;
+import io.swagger.annotations.Api;
+import jdk.nashorn.internal.ir.annotations.Ignore;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@Slf4j
+@Api("公共接口")
+@RestController
+@AllArgsConstructor
+@Ignore
+@RequestMapping(value="/app/common")
+public class CommonController {
+    private IAdHtmlClickLogService adHtmlClickLogService;
+    private RocketMQTemplate rocketMQTemplate;
+
+    @GetMapping("/testSend")
+    public R testSend(String id){
+        AdUploadVo build = AdUploadVo.builder().state(id).type(AdUploadType.ADD_WX).build();
+        rocketMQTemplate.syncSend("ad-upload", JSON.toJSONString(build));
+//        adHtmlClickLogService.upload(id, AdUploadType.ADD_WX, e -> {});
+        return R.ok();
+    }
+
+}

+ 215 - 0
fs-ad-api/src/main/java/com/fs/app/controller/MockAppController.java

@@ -0,0 +1,215 @@
+package com.fs.app.controller;
+
+import com.fs.baidu.domain.BdApi;
+import com.fs.baidu.service.IBdApiService;
+import com.fs.baidu.utils.SignService;
+import com.fs.huifuPay.sdk.opps.core.exception.BasePayException;
+import com.fs.huifuPay.sdk.opps.core.utils.HttpClientUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+@Slf4j
+@RestController
+@RequestMapping("/baiduBack")
+public class MockAppController {
+    private static final String APPID = "appId";
+    private static final String AUTH_CODE = "authCode";
+    private static final String USERID = "userId";
+    private static final String TIMESTAMP = "timestamp";
+    private static final String SIGNATURE = "signature";
+    private static final String STATE = "state";
+    private static final String ACCESSTOKEN_URL = "https://u.baidu.com/oauth/accessToken";
+
+    @Autowired
+    private IBdApiService bdApiService; // 开发者自定义
+    @Autowired
+    private SignService signService; // 开发者可自定义
+
+    @GetMapping("/callback")
+    public String mockApp(HttpServletRequest request) throws BasePayException {
+
+        // 获取请求参数
+        Map<String, String> params = new HashMap<>();
+        this.fillParams(params, request);
+        log.info("callback: params = {}", JSONObject.valueToString(params));
+        int userIdInt = 0;
+        try {
+            userIdInt = Integer.parseInt(params.get(USERID));
+        } catch (Exception e) {
+            return this.getResponseJson(600011, "参数错误", new Object());
+        }
+        // 对签名内容进行判空
+        if (StringUtils.isBlank(params.get(SIGNATURE))) {
+            return this.getResponseJson(600011, "参数错误", new Object());
+        }
+
+        // 获取应用对应的密钥
+        BdApi app = bdApiService.getAppByAppId(params.get(APPID));
+        String sk = app.getAppSecretKey();
+        // 开发者进行验签
+        // 检查状态码
+//        if (!this.checkState(params.get(APPID), app.getAppUserId(), params.get(STATE))) {
+//            log.info("callback: state check fail");
+//            return this.getResponseJson(600011, "状态码错误", new Object());
+//        }
+
+        // 签名验证
+        if (!this.checkSignature(params, sk)) {
+            log.info("callback: signature check fail");
+            return this.getResponseJson(600011, "签名错误", new Object());
+        }
+
+        // 调用接口换取授权令牌
+        String response = this.getAccessToken(params, sk, userIdInt);
+        log.info("callback:getAccesstoken, response={}", response);
+        String accessToken = null;
+        String refreshToken = null;
+        int uid;
+
+        if (response.length() > 0) {
+            JSONObject res = new JSONObject(response);
+            int code = (int) res.get("code");
+            if (code == 0) {
+                JSONObject data = res.getJSONObject("data");
+                accessToken = (String) data.get("accessToken");
+                // 注释部分为 accessToken 其他信息,各应用开发者酌情使用即可
+                 refreshToken = (String) data.get("refreshToken");
+                String openId = data.getString("openId");
+                int expiresIn = data.getInt("expiresIn");
+                int refreshExpiresIn = data.getInt("refreshExpiresIn");
+                app.setAccessToken(accessToken);
+                app.setRefreshToken(refreshToken);
+                app.setExpiresIn(expiresIn);
+                app.setOpenId(openId);
+                app.setRefreshExpiresIn(refreshExpiresIn);
+                app.setAuthCode(params.get(AUTH_CODE));
+                bdApiService.updateById(app);
+
+                // TODO 相关信息落库处理
+            } else {
+                return this.getResponseJson(600011, "未获取到 access_token", new Object());
+            }
+        }
+        Map<String, String> data = new HashMap<>();
+        data.put("accessToken", accessToken);
+        return this.getResponseJson(0, "success", data);
+    }
+
+    /**
+     * 填充请求参数,开发者可用实体代替map
+     *
+     * @param params
+     * @param request
+     */
+    private void fillParams(Map<String, String> params, HttpServletRequest request) {
+        params.put(APPID, request.getParameter(APPID));
+        params.put(AUTH_CODE, request.getParameter(AUTH_CODE));
+        params.put(USERID, request.getParameter(USERID));
+        params.put(TIMESTAMP, request.getParameter(TIMESTAMP));
+        params.put(SIGNATURE, request.getParameter(SIGNATURE));
+        params.put(STATE, request.getParameter(STATE));
+    }
+
+    /**
+     * 校验状态码是否符合预期
+     *
+     * @param appId  应用ID
+     * @param userId 创建应用的ID
+     * @param state  请求参数中的状态码
+     * @return
+     */
+    private boolean checkState(String appId, Long userId, String state) {
+        // md5util 开发者自行开发即可
+        String newState = md5(appId.concat("_").concat(String.valueOf(userId)));
+        return newState.equals(state);
+    }
+    public static String md5(String input) {
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] messageDigest = md.digest(input.getBytes());
+            StringBuilder hexString = new StringBuilder();
+            for (byte b : messageDigest) {
+                String hex = Integer.toHexString(0xff & b);
+                if (hex.length() == 1) {
+                    hexString.append('0');
+                }
+                hexString.append(hex);
+            }
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    /**
+     * 签名验证方法
+     *
+     * @param params
+     * @param sk
+     * @return
+     */
+    private boolean checkSignature(Map<String, String> params, String sk) {
+        // 获取验签字符串:按key自然排序,拼接成 json 字符串,
+        // 示例:str1 = {"appId": xxxxx, "authCode": xxx, "state": xxx,"timestamp": xxx}
+        TreeMap<String, Object> map = new TreeMap<>();
+        map.put(APPID, params.get(APPID));
+        map.put(AUTH_CODE, params.get(AUTH_CODE));
+        map.put(USERID, params.get(USERID));
+        map.put(STATE, params.get(STATE));
+        map.put(TIMESTAMP, params.get(TIMESTAMP));
+        // 根据上述签名算法对接收到的参数签名
+        String sign = signService.paramsSign(sk, map);
+        log.info("callback: signature = {}", sign);
+        // 判断签名和URL传参签名是否一致
+        return params.get(SIGNATURE).equals(sign);
+    }
+
+    /**
+     * 换取授权令牌
+     *
+     * @param params
+     * @param sk
+     * @param userIdInt 授权账户ID
+     * @return
+     */
+    private String getAccessToken(Map<String, String> params, String sk, int userIdInt) throws BasePayException {
+        Map<String, Object> requestMap = new HashMap<>();
+        requestMap.put(APPID, params.get(APPID));
+        requestMap.put("secretKey", sk);
+        requestMap.put(AUTH_CODE, params.get(AUTH_CODE));
+        requestMap.put("grantType", "access_token");
+        requestMap.put("userId", userIdInt);
+
+        String paramsJson = JSONObject.valueToString(requestMap);
+        // 开发者自行增加异常判断
+        return HttpClientUtils.httpPostJson(ACCESSTOKEN_URL, new HashMap<>(), paramsJson);
+    }
+
+    /**
+     * 封装返回json串
+     *
+     * @param code
+     * @param message
+     * @param data
+     * @return
+     */
+    private String getResponseJson(int code, String message, Object data) {
+        // 封装返回字段的map
+        Map<String, Object> responseMap = new HashMap<>();
+        responseMap.put("code", code);
+        responseMap.put("message", message);
+        responseMap.put("data", data);
+        return JSONObject.valueToString(responseMap);
+    }
+}

+ 51 - 0
fs-ad-api/src/main/java/com/fs/app/exception/FSException.java

@@ -0,0 +1,51 @@
+package com.fs.app.exception;
+
+/**
+ * 自定义异常
+ */
+public class FSException extends RuntimeException {
+	private static final long serialVersionUID = 1L;
+	
+    private String msg;
+    private int code = 500;
+    
+    public FSException(String msg) {
+		super(msg);
+		this.msg = msg;
+	}
+	
+	public FSException(String msg, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+	}
+	
+	public FSException(String msg, int code) {
+		super(msg);
+		this.msg = msg;
+		this.code = code;
+	}
+	
+	public FSException(String msg, int code, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+	
+	
+}

+ 81 - 0
fs-ad-api/src/main/java/com/fs/app/exception/FSExceptionHandler.java

@@ -0,0 +1,81 @@
+package com.fs.app.exception;
+
+
+
+
+import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.validation.BindException;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.NoHandlerFoundException;
+
+
+/**
+ * 异常处理器
+ */
+@RestControllerAdvice
+public class FSExceptionHandler {
+	private Logger logger = LoggerFactory.getLogger(getClass());
+
+	/**
+	 * 处理自定义异常
+	 */
+	@ExceptionHandler(FSException.class)
+	public R handleRRException(FSException e){
+		R r = new R();
+		r.put("code", e.getCode());
+		r.put("msg", e.getMessage());
+
+		return r;
+	}
+
+	@ExceptionHandler(NoHandlerFoundException.class)
+	public R handlerNoFoundException(Exception e) {
+		logger.error(e.getMessage(), e);
+		return R.error(404, "路径不存在,请检查路径是否正确");
+	}
+
+	@ExceptionHandler(DuplicateKeyException.class)
+	public R handleDuplicateKeyException(DuplicateKeyException e){
+		logger.error(e.getMessage(), e);
+		return R.error("数据库中已存在该记录");
+	}
+
+
+	@ExceptionHandler(Exception.class)
+	public R handleException(Exception e){
+		logger.error(e.getMessage(), e);
+		return R.error();
+	}
+	@ExceptionHandler(AccessDeniedException.class)
+	public R handleAccessDeniedException(AccessDeniedException e){
+		logger.error(e.getMessage(), e);
+		return R.error("没有权限");
+	}
+
+	@ExceptionHandler(BindException.class)
+	public R bindExceptionHandler(BindException e) {
+		FieldError error = e.getFieldError();
+		String message = String.format("%s",  error.getDefaultMessage());
+		return R.error(message);
+	}
+
+	@ExceptionHandler(MethodArgumentNotValidException.class)
+	public R exceptionHandler(MethodArgumentNotValidException e) {
+		FieldError error = e.getBindingResult().getFieldError();
+		String message = String.format("%s",  error.getDefaultMessage());
+		return R.error(message);
+	}
+	@ExceptionHandler(CustomException.class)
+	public R handleException(CustomException e){
+
+		return R.error(e.getMessage());
+	}
+}

+ 31 - 0
fs-ad-api/src/main/java/com/fs/app/mq/RocketMQAiMsgService.java

@@ -0,0 +1,31 @@
+//package com.fs.app.mq;
+//
+//import cn.hutool.json.JSONUtil;
+//import com.alibaba.fastjson.JSON;
+//import com.fs.ad.service.IAdHtmlClickLogService;
+//import com.fs.fastGpt.mapper.FastGptChatReplaceWordsMapper;
+//import com.fs.fastGpt.service.IFastGptChatSessionService;
+//import com.fs.qw.vo.AdUploadVo;
+//import com.fs.qwHookApi.vo.QwHookMsgVO;
+//import lombok.AllArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+//import org.apache.rocketmq.spring.core.RocketMQListener;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Service;
+//
+//@Slf4j
+//@Service
+//@AllArgsConstructor
+//@RocketMQMessageListener(topic = "msg", consumerGroup = "msg-group")
+//public class RocketMQAiMsgService implements RocketMQListener<String> {
+//
+//    @Autowired
+//    private IFastGptChatSessionService fastGptChatSessionService;
+//    @Override
+//    public void onMessage(String message) {
+//        log.info("消息队列接收到消息:{}",  message);
+//        QwHookMsgVO msgVo= JSONUtil.toBean(message,QwHookMsgVO.class);
+//        fastGptChatSessionService.qwHookNotifyAddMsg(msgVo);
+//    }
+//}

+ 30 - 0
fs-ad-api/src/main/java/com/fs/app/mq/RocketMQConsumerService.java

@@ -0,0 +1,30 @@
+package com.fs.app.mq;
+
+import com.alibaba.fastjson.JSON;
+import com.fs.ad.service.IAdHtmlClickLogService;
+import com.fs.common.utils.StringUtils;
+import com.fs.qw.domain.QwExternalContact;
+import com.fs.qw.vo.AdUploadVo;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+import org.apache.rocketmq.spring.core.RocketMQListener;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+@AllArgsConstructor
+@RocketMQMessageListener(topic = "${rocketmq.consumer.topic}", consumerGroup = "${rocketmq.consumer.group}")
+public class RocketMQConsumerService implements RocketMQListener<String> {
+
+    private final IAdHtmlClickLogService  adHtmlClickLogService;
+
+    @Override
+    public void onMessage(String message) {
+        AdUploadVo adUploadVo = JSON.parseObject(message, AdUploadVo.class);
+        if(adUploadVo == null  || StringUtils.isEmpty(adUploadVo.getState()) || "null".equals(adUploadVo.getState())){
+            return;
+        }
+        adHtmlClickLogService.upload(adUploadVo.getState(), adUploadVo.getType());
+    }
+}

+ 26 - 0
fs-ad-api/src/main/java/com/fs/app/mq/RocketMQConsumerServiceByQw.java

@@ -0,0 +1,26 @@
+//package com.fs.app.mq;
+//
+//import com.alibaba.fastjson.JSON;
+//import com.fs.ad.service.IAdHtmlClickLogService;
+//import com.fs.qw.vo.AdUploadVo;
+//import lombok.AllArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+//import org.apache.rocketmq.spring.core.RocketMQListener;
+//import org.springframework.stereotype.Service;
+//
+//@Slf4j
+//@Service
+//@AllArgsConstructor
+////@RocketMQMessageListener(topic = "ad-qw-external-contact", consumerGroup = "ad-group")
+//@RocketMQMessageListener(topic = "ad-qw-external-contact", consumerGroup = "test-group")
+//public class RocketMQConsumerServiceByQw implements RocketMQListener<String> {
+//
+//
+//    @Override
+//    public void onMessage(String message) {
+//
+//        log.info("消息队列接收到消息qw:{}",  message);
+//
+//    }
+//}

+ 34 - 0
fs-ad-api/src/main/java/com/fs/app/task/Task.java

@@ -0,0 +1,34 @@
+package com.fs.app.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fs.ad.domain.AdHtmlClickLog;
+import com.fs.ad.service.IAdHtmlClickLogService;
+import com.fs.ad.service.impl.AdHtmlClickLogServiceImpl;
+import com.fs.common.core.redis.RedisCacheT;
+import lombok.AllArgsConstructor;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+@Component
+@AllArgsConstructor
+public class Task {
+    private RedisCacheT<AdHtmlClickLog> redisCache;
+    private IAdHtmlClickLogService adHtmlClickLogService;
+
+//    @Scheduled(cron = "0/30 * * * * ?")
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void saveLog() {
+        List<AdHtmlClickLog> list = redisCache.getCacheListByPattern(AdHtmlClickLogServiceImpl.AD_LOG_KEY + "*");
+        list.stream().filter(e -> e.getId() == null).forEach(e -> {
+            String key = AdHtmlClickLogServiceImpl.genKey(e.getVid(), e.getType(), e.getClickType());
+            adHtmlClickLogService.save(e);
+            redisCache.setCacheObject(key, e, LocalDateTime.now().until(e.getLastTime(), ChronoUnit.MINUTES), TimeUnit.MINUTES);
+        });
+        list.stream().filter(e -> e.getId() != null).forEach(e -> adHtmlClickLogService.update(e, new QueryWrapper<AdHtmlClickLog>().eq("vid", e.getVid()).eq("click_type", e.getClickType())));
+    }
+}

+ 182 - 0
fs-ad-api/src/main/java/com/fs/framework/aspectj/DataScopeAspect.java

@@ -0,0 +1,182 @@
+package com.fs.framework.aspectj;
+
+import com.fs.common.annotation.DataScope;
+import com.fs.common.core.domain.BaseEntity;
+import com.fs.common.core.domain.entity.SysRole;
+import com.fs.common.core.domain.entity.SysUser;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.utils.SecurityUtils;
+import com.fs.common.utils.StringUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+
+/**
+ * 数据过滤处理
+ *
+
+ */
+@Aspect
+@Component
+public class DataScopeAspect
+{
+    /**
+     * 全部数据权限
+     */
+    public static final String DATA_SCOPE_ALL = "1";
+
+    /**
+     * 自定数据权限
+     */
+    public static final String DATA_SCOPE_CUSTOM = "2";
+
+    /**
+     * 部门数据权限
+     */
+    public static final String DATA_SCOPE_DEPT = "3";
+
+    /**
+     * 部门及以下数据权限
+     */
+    public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
+
+    /**
+     * 仅本人数据权限
+     */
+    public static final String DATA_SCOPE_SELF = "5";
+
+    /**
+     * 数据权限过滤关键字
+     */
+    public static final String DATA_SCOPE = "dataScope";
+
+    // 配置织入点
+    @Pointcut("@annotation(com.fs.common.annotation.DataScope)")
+    public void dataScopePointCut()
+    {
+    }
+
+    @Before("dataScopePointCut()")
+    public void doBefore(JoinPoint point) throws Throwable
+    {
+        clearDataScope(point);
+        handleDataScope(point);
+    }
+
+    protected void handleDataScope(final JoinPoint joinPoint)
+    {
+        // 获得注解
+        DataScope controllerDataScope = getAnnotationLog(joinPoint);
+        if (controllerDataScope == null)
+        {
+            return;
+        }
+        // 获取当前的用户
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (StringUtils.isNotNull(loginUser))
+        {
+            SysUser currentUser = loginUser.getUser();
+            // 如果是超级管理员,则不过滤数据
+            if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
+            {
+                dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
+                        controllerDataScope.userAlias());
+            }
+        }
+    }
+
+    /**
+     * 数据范围过滤
+     *
+     * @param joinPoint 切点
+     * @param user 用户
+     * @param userAlias 别名
+     */
+    public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
+    {
+        StringBuilder sqlString = new StringBuilder();
+
+        for (SysRole role : user.getRoles())
+        {
+            String dataScope = role.getDataScope();
+            if (DATA_SCOPE_ALL.equals(dataScope))
+            {
+                sqlString = new StringBuilder();
+                break;
+            }
+            else if (DATA_SCOPE_CUSTOM.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(
+                        " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
+                        role.getRoleId()));
+            }
+            else if (DATA_SCOPE_DEPT.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
+            }
+            else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
+            {
+                sqlString.append(StringUtils.format(
+                        " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
+                        deptAlias, user.getDeptId(), user.getDeptId()));
+            }
+            else if (DATA_SCOPE_SELF.equals(dataScope))
+            {
+                if (StringUtils.isNotBlank(userAlias))
+                {
+                    sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
+                }
+                else
+                {
+                    // 数据权限为仅本人且没有userAlias别名不查询任何数据
+                    sqlString.append(" OR 1=0 ");
+                }
+            }
+        }
+
+        if (StringUtils.isNotBlank(sqlString.toString()))
+        {
+            Object params = joinPoint.getArgs()[0];
+            if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
+            {
+                BaseEntity baseEntity = (BaseEntity) params;
+                baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
+            }
+        }
+    }
+
+    /**
+     * 是否存在注解,如果存在就获取
+     */
+    private DataScope getAnnotationLog(JoinPoint joinPoint)
+    {
+        Signature signature = joinPoint.getSignature();
+        MethodSignature methodSignature = (MethodSignature) signature;
+        Method method = methodSignature.getMethod();
+
+        if (method != null)
+        {
+            return method.getAnnotation(DataScope.class);
+        }
+        return null;
+    }
+
+    /**
+     * 拼接权限sql前先清空params.dataScope参数防止注入
+     */
+    private void clearDataScope(final JoinPoint joinPoint)
+    {
+        Object params = joinPoint.getArgs()[0];
+        if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
+        {
+            BaseEntity baseEntity = (BaseEntity) params;
+            baseEntity.getParams().put(DATA_SCOPE, "");
+        }
+    }
+}

+ 73 - 0
fs-ad-api/src/main/java/com/fs/framework/aspectj/DataSourceAspect.java

@@ -0,0 +1,73 @@
+package com.fs.framework.aspectj;
+
+import com.fs.common.annotation.DataSource;
+import com.fs.common.utils.StringUtils;
+import com.fs.framework.datasource.DynamicDataSourceContextHolder;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.util.Objects;
+
+/**
+ * 多数据源处理
+ * 
+
+ */
+@Aspect
+@Order(1)
+@Component
+public class DataSourceAspect
+{
+    protected Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Pointcut("@annotation(com.fs.common.annotation.DataSource)"
+            + "|| @within(com.fs.common.annotation.DataSource)")
+    public void dsPointCut()
+    {
+
+    }
+
+    @Around("dsPointCut()")
+    public Object around(ProceedingJoinPoint point) throws Throwable
+    {
+        DataSource dataSource = getDataSource(point);
+
+        if (StringUtils.isNotNull(dataSource))
+        {
+            DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name());
+        }
+
+        try
+        {
+            return point.proceed();
+        }
+        finally
+        {
+            // 销毁数据源 在执行方法之后
+            DynamicDataSourceContextHolder.clearDataSourceType();
+        }
+    }
+
+    /**
+     * 获取需要切换的数据源
+     */
+    public DataSource getDataSource(ProceedingJoinPoint point)
+    {
+        MethodSignature signature = (MethodSignature) point.getSignature();
+        DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class);
+        if (Objects.nonNull(dataSource))
+        {
+            return dataSource;
+        }
+
+        return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class);
+    }
+}

+ 245 - 0
fs-ad-api/src/main/java/com/fs/framework/aspectj/LogAspect.java

@@ -0,0 +1,245 @@
+package com.fs.framework.aspectj;
+
+import com.alibaba.fastjson.JSON;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.enums.BusinessStatus;
+import com.fs.common.enums.HttpMethod;
+import com.fs.common.utils.SecurityUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.ip.IpUtils;
+
+import com.fs.framework.manager.AsyncManager;
+import com.fs.framework.manager.factory.AsyncFactory;
+import com.fs.system.domain.SysOperLog;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.HandlerMapping;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 操作日志记录处理
+ * 
+
+ */
+@Aspect
+@Component
+public class LogAspect
+{
+    private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
+
+    // 配置织入点
+    @Pointcut("@annotation(com.fs.common.annotation.Log)")
+    public void logPointCut()
+    {
+    }
+
+    /**
+     * 处理完请求后执行
+     *
+     * @param joinPoint 切点
+     */
+    @AfterReturning(pointcut = "logPointCut()", returning = "jsonResult")
+    public void doAfterReturning(JoinPoint joinPoint, Object jsonResult)
+    {
+        handleLog(joinPoint, null, jsonResult);
+    }
+
+    /**
+     * 拦截异常操作
+     * 
+     * @param joinPoint 切点
+     * @param e 异常
+     */
+    @AfterThrowing(value = "logPointCut()", throwing = "e")
+    public void doAfterThrowing(JoinPoint joinPoint, Exception e)
+    {
+        handleLog(joinPoint, e, null);
+    }
+
+    protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult)
+    {
+        try
+        {
+            // 获得注解
+            Log controllerLog = getAnnotationLog(joinPoint);
+            if (controllerLog == null)
+            {
+                return;
+            }
+
+            // 获取当前的用户
+            LoginUser loginUser = SecurityUtils.getLoginUser();
+
+            // *========数据库日志=========*//
+            SysOperLog operLog = new SysOperLog();
+            operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
+            // 请求的地址
+            String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
+            operLog.setOperIp(ip);
+            // 返回参数
+            operLog.setJsonResult(JSON.toJSONString(jsonResult));
+
+            operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
+            if (loginUser != null)
+            {
+                operLog.setOperName(loginUser.getUsername());
+            }
+
+            if (e != null)
+            {
+                operLog.setStatus(BusinessStatus.FAIL.ordinal());
+                operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
+            }
+            // 设置方法名称
+            String className = joinPoint.getTarget().getClass().getName();
+            String methodName = joinPoint.getSignature().getName();
+            operLog.setMethod(className + "." + methodName + "()");
+            // 设置请求方式
+            operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
+            // 处理设置注解上的参数
+            getControllerMethodDescription(joinPoint, controllerLog, operLog);
+            // 保存数据库
+            AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
+        }
+        catch (Exception exp)
+        {
+            // 记录本地异常日志
+            log.error("==前置通知异常==");
+            log.error("异常信息:{}", exp.getMessage());
+            exp.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取注解中对方法的描述信息 用于Controller层注解
+     * 
+     * @param log 日志
+     * @param operLog 操作日志
+     * @throws Exception
+     */
+    public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception
+    {
+        // 设置action动作
+        operLog.setBusinessType(log.businessType().ordinal());
+        // 设置标题
+        operLog.setTitle(log.title());
+        // 设置操作人类别
+        operLog.setOperatorType(log.operatorType().ordinal());
+        // 是否需要保存request,参数和值
+        if (log.isSaveRequestData())
+        {
+            // 获取参数的信息,传入到数据库中。
+            setRequestValue(joinPoint, operLog);
+        }
+    }
+
+    /**
+     * 获取请求的参数,放到log中
+     * 
+     * @param operLog 操作日志
+     * @throws Exception 异常
+     */
+    private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception
+    {
+        String requestMethod = operLog.getRequestMethod();
+        if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod))
+        {
+            String params = argsArrayToString(joinPoint.getArgs());
+            operLog.setOperParam(StringUtils.substring(params, 0, 2000));
+        }
+        else
+        {
+            Map<?, ?> paramsMap = (Map<?, ?>) ServletUtils.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
+            operLog.setOperParam(StringUtils.substring(paramsMap.toString(), 0, 2000));
+        }
+    }
+
+    /**
+     * 是否存在注解,如果存在就获取
+     */
+    private Log getAnnotationLog(JoinPoint joinPoint) throws Exception
+    {
+        Signature signature = joinPoint.getSignature();
+        MethodSignature methodSignature = (MethodSignature) signature;
+        Method method = methodSignature.getMethod();
+
+        if (method != null)
+        {
+            return method.getAnnotation(Log.class);
+        }
+        return null;
+    }
+
+    /**
+     * 参数拼装
+     */
+    private String argsArrayToString(Object[] paramsArray)
+    {
+        String params = "";
+        if (paramsArray != null && paramsArray.length > 0)
+        {
+            for (int i = 0; i < paramsArray.length; i++)
+            {
+                if (StringUtils.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i]))
+                {
+                    Object jsonObj = JSON.toJSON(paramsArray[i]);
+                    params += jsonObj.toString() + " ";
+                }
+            }
+        }
+        return params.trim();
+    }
+
+    /**
+     * 判断是否需要过滤的对象。
+     * 
+     * @param o 对象信息。
+     * @return 如果是需要过滤的对象,则返回true;否则返回false。
+     */
+    @SuppressWarnings("rawtypes")
+    public boolean isFilterObject(final Object o)
+    {
+        Class<?> clazz = o.getClass();
+        if (clazz.isArray())
+        {
+            return clazz.getComponentType().isAssignableFrom(MultipartFile.class);
+        }
+        else if (Collection.class.isAssignableFrom(clazz))
+        {
+            Collection collection = (Collection) o;
+            for (Iterator iter = collection.iterator(); iter.hasNext();)
+            {
+                return iter.next() instanceof MultipartFile;
+            }
+        }
+        else if (Map.class.isAssignableFrom(clazz))
+        {
+            Map map = (Map) o;
+            for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
+            {
+                Map.Entry entry = (Map.Entry) iter.next();
+                return entry.getValue() instanceof MultipartFile;
+            }
+        }
+        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
+                || o instanceof BindingResult;
+    }
+}

+ 117 - 0
fs-ad-api/src/main/java/com/fs/framework/aspectj/RateLimiterAspect.java

@@ -0,0 +1,117 @@
+package com.fs.framework.aspectj;
+
+import com.fs.common.annotation.RateLimiter;
+import com.fs.common.enums.LimitType;
+import com.fs.common.exception.ServiceException;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.ip.IpUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.script.RedisScript;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 限流处理
+ *
+
+ */
+@Aspect
+@Component
+public class RateLimiterAspect
+{
+    private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class);
+
+    private RedisTemplate<Object, Object> redisTemplate;
+
+    private RedisScript<Long> limitScript;
+
+    @Autowired
+    public void setRedisTemplate1(RedisTemplate<Object, Object> redisTemplate)
+    {
+        this.redisTemplate = redisTemplate;
+    }
+
+    @Autowired
+    public void setLimitScript(RedisScript<Long> limitScript)
+    {
+        this.limitScript = limitScript;
+    }
+
+    // 配置织入点
+    @Pointcut("@annotation(com.fs.common.annotation.RateLimiter)")
+    public void rateLimiterPointCut()
+    {
+    }
+
+    @Before("rateLimiterPointCut()")
+    public void doBefore(JoinPoint point) throws Throwable
+    {
+        RateLimiter rateLimiter = getAnnotationRateLimiter(point);
+        String key = rateLimiter.key();
+        int time = rateLimiter.time();
+        int count = rateLimiter.count();
+
+        String combineKey = getCombineKey(rateLimiter, point);
+        List<Object> keys = Collections.singletonList(combineKey);
+        try
+        {
+            Long number = redisTemplate.execute(limitScript, keys, count, time);
+            if (StringUtils.isNull(number) || number.intValue() > count)
+            {
+                throw new ServiceException("访问过于频繁,请稍后再试");
+            }
+            log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), key);
+        }
+        catch (ServiceException e)
+        {
+            throw e;
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException("服务器限流异常,请稍后再试");
+        }
+    }
+
+    /**
+     * 是否存在注解,如果存在就获取
+     */
+    private RateLimiter getAnnotationRateLimiter(JoinPoint joinPoint)
+    {
+        Signature signature = joinPoint.getSignature();
+        MethodSignature methodSignature = (MethodSignature) signature;
+        Method method = methodSignature.getMethod();
+
+        if (method != null)
+        {
+            return method.getAnnotation(RateLimiter.class);
+        }
+        return null;
+    }
+
+    public String getCombineKey(RateLimiter rateLimiter, JoinPoint point)
+    {
+        StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
+        if (rateLimiter.limitType() == LimitType.IP)
+        {
+            stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest()));
+        }
+        MethodSignature signature = (MethodSignature) point.getSignature();
+        Method method = signature.getMethod();
+        Class<?> targetClass = method.getDeclaringClass();
+        stringBuffer.append("-").append(targetClass.getName()).append("- ").append(method.getName());
+        return stringBuffer.toString();
+    }
+}

+ 31 - 0
fs-ad-api/src/main/java/com/fs/framework/config/ApplicationConfig.java

@@ -0,0 +1,31 @@
+package com.fs.framework.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+import java.util.TimeZone;
+
+/**
+ * 程序注解配置
+ *
+
+ */
+@Configuration
+// 表示通过aop框架暴露该代理对象,AopContext能够访问
+@EnableAspectJAutoProxy(exposeProxy = true)
+// 指定要扫描的Mapper类的包的路径
+@MapperScan("com.fs.**.mapper")
+public class ApplicationConfig
+{
+    /**
+     * 时区配置
+     */
+    @Bean
+    public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
+    {
+        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
+    }
+}

+ 85 - 0
fs-ad-api/src/main/java/com/fs/framework/config/CaptchaConfig.java

@@ -0,0 +1,85 @@
+package com.fs.framework.config;
+
+import com.google.code.kaptcha.impl.DefaultKaptcha;
+import com.google.code.kaptcha.util.Config;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Properties;
+
+import static com.google.code.kaptcha.Constants.*;
+
+/**
+ * 验证码配置
+ * 
+
+ */
+@Configuration
+public class CaptchaConfig
+{
+    @Bean(name = "captchaProducer")
+    public DefaultKaptcha getKaptchaBean()
+    {
+        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
+        Properties properties = new Properties();
+        // 是否有边框 默认为true 我们可以自己设置yes,no
+        properties.setProperty(KAPTCHA_BORDER, "yes");
+        // 验证码文本字符颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black");
+        // 验证码图片宽度 默认为200
+        properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160");
+        // 验证码图片高度 默认为50
+        properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
+        // 验证码文本字符大小 默认为40
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38");
+        // KAPTCHA_SESSION_KEY
+        properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode");
+        // 验证码文本字符长度 默认为5
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4");
+        // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
+        // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
+        properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
+        Config config = new Config(properties);
+        defaultKaptcha.setConfig(config);
+        return defaultKaptcha;
+    }
+
+    @Bean(name = "captchaProducerMath")
+    public DefaultKaptcha getKaptchaBeanMath()
+    {
+        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
+        Properties properties = new Properties();
+        // 是否有边框 默认为true 我们可以自己设置yes,no
+        properties.setProperty(KAPTCHA_BORDER, "yes");
+        // 边框颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90");
+        // 验证码文本字符颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue");
+        // 验证码图片宽度 默认为200
+        properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160");
+        // 验证码图片高度 默认为50
+        properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
+        // 验证码文本字符大小 默认为40
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35");
+        // KAPTCHA_SESSION_KEY
+        properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
+        // 验证码文本生成器
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.fs.framework.config.KaptchaTextCreator");
+        // 验证码文本字符间距 默认为2
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
+        // 验证码文本字符长度 默认为5
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6");
+        // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
+        // 验证码噪点颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_NOISE_COLOR, "white");
+        // 干扰实现类
+        properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise");
+        // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
+        properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
+        Config config = new Config(properties);
+        defaultKaptcha.setConfig(config);
+        return defaultKaptcha;
+    }
+}

+ 100 - 0
fs-ad-api/src/main/java/com/fs/framework/config/DataSourceConfig.java

@@ -0,0 +1,100 @@
+package com.fs.framework.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
+import com.alibaba.druid.util.Utils;
+import com.fs.common.enums.DataSourceType;
+import com.fs.framework.datasource.DynamicDataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import javax.servlet.*;
+import javax.sql.DataSource;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Configuration
+public class DataSourceConfig {
+
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource.clickhouse")
+    public DataSource clickhouseDataSource() {
+        return new DruidDataSource();
+    }
+
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource.mysql.druid.master")
+    public DataSource masterDataSource() {
+        return new DruidDataSource();
+    }
+
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource.mysql.druid.slave")
+    public DataSource slaveDataSource() {
+        return new DruidDataSource();
+    }
+
+    @Bean
+    @Primary
+    public DynamicDataSource dataSource(@Qualifier("clickhouseDataSource") DataSource clickhouseDataSource,
+                                        @Qualifier("masterDataSource") DataSource masterDataSource,
+                                        @Qualifier("slaveDataSource") DataSource slaveDataSource) {
+        Map<Object, Object> targetDataSources = new HashMap<>();
+        targetDataSources.put(DataSourceType.MASTER, masterDataSource);
+        targetDataSources.put(DataSourceType.SLAVE, slaveDataSource);
+        targetDataSources.put(DataSourceType.CLICKHOUSE.name(), clickhouseDataSource); // Ensure matching key
+        return new DynamicDataSource(masterDataSource, targetDataSources);
+    }
+
+    /**
+     * 去除监控页面底部的广告
+     */
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @Bean
+    @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
+    public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
+    {
+        // 获取web监控页面的参数
+        DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
+        // 提取common.js的配置路径
+        String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
+        String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
+        final String filePath = "support/http/resources/js/common.js";
+        // 创建filter进行过滤
+        Filter filter = new Filter()
+        {
+            @Override
+            public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
+            {
+            }
+            @Override
+            public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+                    throws IOException, ServletException
+            {
+                chain.doFilter(request, response);
+                // 重置缓冲区,响应头不会被重置
+                response.resetBuffer();
+                // 获取common.js
+                String text = Utils.readFromResource(filePath);
+                // 正则替换banner, 除去底部的广告信息
+                text = text.replaceAll("<a.*?banner\"></a><br/>", "");
+                text = text.replaceAll("powered.*?shrek.wang</a>", "");
+                response.getWriter().write(text);
+            }
+            @Override
+            public void destroy()
+            {
+            }
+        };
+        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
+        registrationBean.setFilter(filter);
+        registrationBean.addUrlPatterns(commonJsPattern);
+        return registrationBean;
+    }
+}

+ 123 - 0
fs-ad-api/src/main/java/com/fs/framework/config/DruidConfig.java

@@ -0,0 +1,123 @@
+//package com.fs.framework.config;
+//
+//import com.alibaba.druid.pool.DruidDataSource;
+//import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
+//import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
+//import com.alibaba.druid.util.Utils;
+//import com.fs.common.enums.DataSourceType;
+//import com.fs.common.utils.spring.SpringUtils;
+//import com.fs.framework.config.properties.DruidProperties;
+//import com.fs.framework.datasource.DynamicDataSource;
+//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+//import org.springframework.boot.context.properties.ConfigurationProperties;
+//import org.springframework.boot.web.servlet.FilterRegistrationBean;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.context.annotation.Primary;
+//
+//import javax.servlet.*;
+//import javax.sql.DataSource;
+//import java.io.IOException;
+//import java.util.HashMap;
+//import java.util.Map;
+//
+///**
+// * druid 配置多数据源
+// *
+//
+// */
+//@Configuration
+//public class DruidConfig
+//{
+//    @Bean
+//    @ConfigurationProperties("spring.datasource.druid.master")
+//    public DataSource masterDataSource(DruidProperties druidProperties)
+//    {
+//        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+//        return druidProperties.dataSource(dataSource);
+//    }
+//
+//    @Bean
+//    @ConfigurationProperties("spring.datasource.druid.slave")
+//    @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
+//    public DataSource slaveDataSource(DruidProperties druidProperties)
+//    {
+//        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+//        return druidProperties.dataSource(dataSource);
+//    }
+//
+//    @Bean(name = "dynamicDataSource")
+//    @Primary
+//    public DynamicDataSource dataSource(DataSource masterDataSource)
+//    {
+//        Map<Object, Object> targetDataSources = new HashMap<>();
+//        targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
+//        setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+//        return new DynamicDataSource(masterDataSource, targetDataSources);
+//    }
+//
+//    /**
+//     * 设置数据源
+//     *
+//     * @param targetDataSources 备选数据源集合
+//     * @param sourceName 数据源名称
+//     * @param beanName bean名称
+//     */
+//    public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
+//    {
+//        try
+//        {
+//            DataSource dataSource = SpringUtils.getBean(beanName);
+//            targetDataSources.put(sourceName, dataSource);
+//        }
+//        catch (Exception e)
+//        {
+//        }
+//    }
+//
+//    /**
+//     * 去除监控页面底部的广告
+//     */
+//    @SuppressWarnings({ "rawtypes", "unchecked" })
+//    @Bean
+//    @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
+//    public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
+//    {
+//        // 获取web监控页面的参数
+//        DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
+//        // 提取common.js的配置路径
+//        String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
+//        String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
+//        final String filePath = "support/http/resources/js/common.js";
+//        // 创建filter进行过滤
+//        Filter filter = new Filter()
+//        {
+//            @Override
+//            public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
+//            {
+//            }
+//            @Override
+//            public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+//                    throws IOException, ServletException
+//            {
+//                chain.doFilter(request, response);
+//                // 重置缓冲区,响应头不会被重置
+//                response.resetBuffer();
+//                // 获取common.js
+//                String text = Utils.readFromResource(filePath);
+//                // 正则替换banner, 除去底部的广告信息
+//                text = text.replaceAll("<a.*?banner\"></a><br/>", "");
+//                text = text.replaceAll("powered.*?shrek.wang</a>", "");
+//                response.getWriter().write(text);
+//            }
+//            @Override
+//            public void destroy()
+//            {
+//            }
+//        };
+//        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
+//        registrationBean.setFilter(filter);
+//        registrationBean.addUrlPatterns(commonJsPattern);
+//        return registrationBean;
+//    }
+//}

+ 72 - 0
fs-ad-api/src/main/java/com/fs/framework/config/FastJson2JsonRedisSerializer.java

@@ -0,0 +1,72 @@
+package com.fs.framework.config;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.parser.ParserConfig;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import org.springframework.data.redis.serializer.RedisSerializer;
+import org.springframework.data.redis.serializer.SerializationException;
+import org.springframework.util.Assert;
+
+import java.nio.charset.Charset;
+
+/**
+ * Redis使用FastJson序列化
+ * 
+
+ */
+public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
+{
+    @SuppressWarnings("unused")
+    private ObjectMapper objectMapper = new ObjectMapper();
+
+    public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+
+    private Class<T> clazz;
+
+    static
+    {
+        ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
+    }
+
+    public FastJson2JsonRedisSerializer(Class<T> clazz)
+    {
+        super();
+        this.clazz = clazz;
+    }
+
+    @Override
+    public byte[] serialize(T t) throws SerializationException
+    {
+        if (t == null)
+        {
+            return new byte[0];
+        }
+        return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET);
+    }
+
+    @Override
+    public T deserialize(byte[] bytes) throws SerializationException
+    {
+        if (bytes == null || bytes.length <= 0)
+        {
+            return null;
+        }
+        String str = new String(bytes, DEFAULT_CHARSET);
+
+        return JSON.parseObject(str, clazz);
+    }
+
+    public void setObjectMapper(ObjectMapper objectMapper)
+    {
+        Assert.notNull(objectMapper, "'objectMapper' must not be null");
+        this.objectMapper = objectMapper;
+    }
+
+    protected JavaType getJavaType(Class<?> clazz)
+    {
+        return TypeFactory.defaultInstance().constructType(clazz);
+    }
+}

+ 59 - 0
fs-ad-api/src/main/java/com/fs/framework/config/FilterConfig.java

@@ -0,0 +1,59 @@
+package com.fs.framework.config;
+
+import com.fs.common.filter.RepeatableFilter;
+import com.fs.common.filter.XssFilter;
+import com.fs.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.DispatcherType;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Filter配置
+ *
+
+ */
+@Configuration
+@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
+public class FilterConfig
+{
+    @Value("${xss.excludes}")
+    private String excludes;
+
+    @Value("${xss.urlPatterns}")
+    private String urlPatterns;
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @Bean
+    public FilterRegistrationBean xssFilterRegistration()
+    {
+        FilterRegistrationBean registration = new FilterRegistrationBean();
+        registration.setDispatcherTypes(DispatcherType.REQUEST);
+        registration.setFilter(new XssFilter());
+        registration.addUrlPatterns(StringUtils.split(urlPatterns, ","));
+        registration.setName("xssFilter");
+        registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
+        Map<String, String> initParameters = new HashMap<String, String>();
+        initParameters.put("excludes", excludes);
+        registration.setInitParameters(initParameters);
+        return registration;
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    @Bean
+    public FilterRegistrationBean someFilterRegistration()
+    {
+        FilterRegistrationBean registration = new FilterRegistrationBean();
+        registration.setFilter(new RepeatableFilter());
+        registration.addUrlPatterns("/*");
+        registration.setName("repeatableFilter");
+        registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
+        return registration;
+    }
+
+}

+ 76 - 0
fs-ad-api/src/main/java/com/fs/framework/config/KaptchaTextCreator.java

@@ -0,0 +1,76 @@
+package com.fs.framework.config;
+
+import com.google.code.kaptcha.text.impl.DefaultTextCreator;
+
+import java.util.Random;
+
+/**
+ * 验证码文本生成器
+ * 
+
+ */
+public class KaptchaTextCreator extends DefaultTextCreator
+{
+    private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
+
+    @Override
+    public String getText()
+    {
+        Integer result = 0;
+        Random random = new Random();
+        int x = random.nextInt(10);
+        int y = random.nextInt(10);
+        StringBuilder suChinese = new StringBuilder();
+        int randomoperands = (int) Math.round(Math.random() * 2);
+        if (randomoperands == 0)
+        {
+            result = x * y;
+            suChinese.append(CNUMBERS[x]);
+            suChinese.append("*");
+            suChinese.append(CNUMBERS[y]);
+        }
+        else if (randomoperands == 1)
+        {
+            if (!(x == 0) && y % x == 0)
+            {
+                result = y / x;
+                suChinese.append(CNUMBERS[y]);
+                suChinese.append("/");
+                suChinese.append(CNUMBERS[x]);
+            }
+            else
+            {
+                result = x + y;
+                suChinese.append(CNUMBERS[x]);
+                suChinese.append("+");
+                suChinese.append(CNUMBERS[y]);
+            }
+        }
+        else if (randomoperands == 2)
+        {
+            if (x >= y)
+            {
+                result = x - y;
+                suChinese.append(CNUMBERS[x]);
+                suChinese.append("-");
+                suChinese.append(CNUMBERS[y]);
+            }
+            else
+            {
+                result = y - x;
+                suChinese.append(CNUMBERS[y]);
+                suChinese.append("-");
+                suChinese.append(CNUMBERS[x]);
+            }
+        }
+        else
+        {
+            result = x + y;
+            suChinese.append(CNUMBERS[x]);
+            suChinese.append("+");
+            suChinese.append(CNUMBERS[y]);
+        }
+        suChinese.append("=?@" + result);
+        return suChinese.toString();
+    }
+}

+ 150 - 0
fs-ad-api/src/main/java/com/fs/framework/config/MyBatisConfig.java

@@ -0,0 +1,150 @@
+package com.fs.framework.config;
+
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import com.fs.common.utils.StringUtils;
+import org.apache.ibatis.io.VFS;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.util.ClassUtils;
+
+import javax.sql.DataSource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * Mybatis支持*匹配扫描包
+ *
+
+ */
+@Configuration
+public class MyBatisConfig
+{
+    @Autowired
+    private Environment env;
+
+    static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
+
+    public static String setTypeAliasesPackage(String typeAliasesPackage)
+    {
+        ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
+        MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
+        List<String> allResult = new ArrayList<String>();
+        try
+        {
+            for (String aliasesPackage : typeAliasesPackage.split(","))
+            {
+                List<String> result = new ArrayList<String>();
+                aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+                        + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
+                Resource[] resources = resolver.getResources(aliasesPackage);
+                if (resources != null && resources.length > 0)
+                {
+                    MetadataReader metadataReader = null;
+                    for (Resource resource : resources)
+                    {
+                        if (resource.isReadable())
+                        {
+                            metadataReader = metadataReaderFactory.getMetadataReader(resource);
+                            try
+                            {
+                                result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
+                            }
+                            catch (ClassNotFoundException e)
+                            {
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+                }
+                if (result.size() > 0)
+                {
+                    HashSet<String> hashResult = new HashSet<String>(result);
+                    allResult.addAll(hashResult);
+                }
+            }
+            if (allResult.size() > 0)
+            {
+                typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
+            }
+            else
+            {
+                throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
+            }
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+        return typeAliasesPackage;
+    }
+
+    public Resource[] resolveMapperLocations(String[] mapperLocations)
+    {
+        ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
+        List<Resource> resources = new ArrayList<Resource>();
+        if (mapperLocations != null)
+        {
+            for (String mapperLocation : mapperLocations)
+            {
+                try
+                {
+                    Resource[] mappers = resourceResolver.getResources(mapperLocation);
+                    resources.addAll(Arrays.asList(mappers));
+                }
+                catch (IOException e)
+                {
+                    // ignore
+                }
+            }
+        }
+        return resources.toArray(new Resource[resources.size()]);
+    }
+
+//    @Bean
+//    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
+//    {
+//        String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
+//        String mapperLocations = env.getProperty("mybatis.mapperLocations");
+//        String configLocation = env.getProperty("mybatis.configLocation");
+//        typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
+//        VFS.addImplClass(SpringBootVFS.class);
+//
+//        final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+//        sessionFactory.setDataSource(dataSource);
+//        sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
+//        sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
+//        sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
+//        return sessionFactory.getObject();
+//    }
+    @Bean
+    public SqlSessionFactory sqlSessionFactorys(DataSource dataSource) throws Exception
+    {
+        String typeAliasesPackage = env.getProperty("mybatis-plus.typeAliasesPackage");
+        String mapperLocations = env.getProperty("mybatis-plus.mapperLocations");
+        String configLocation = env.getProperty("mybatis-plus.configLocation");
+        typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
+        VFS.addImplClass(SpringBootVFS.class);
+
+        final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
+        sessionFactory.setDataSource(dataSource);
+        sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
+        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+        sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
+        return sessionFactory.getObject();
+    }
+}

+ 121 - 0
fs-ad-api/src/main/java/com/fs/framework/config/RedisConfig.java

@@ -0,0 +1,121 @@
+package com.fs.framework.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.script.DefaultRedisScript;
+import org.springframework.data.redis.serializer.GenericToStringSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+/**
+ * redis配置
+ *
+
+ */
+@Configuration
+@EnableCaching
+public class RedisConfig extends CachingConfigurerSupport
+{
+    @Bean
+    @SuppressWarnings(value = { "unchecked", "rawtypes" })
+    public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
+    {
+        RedisTemplate<Object, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(connectionFactory);
+
+        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
+        serializer.setObjectMapper(mapper);
+
+        // 使用StringRedisSerializer来序列化和反序列化redis的key值
+        template.setKeySerializer(new StringRedisSerializer());
+        template.setValueSerializer(serializer);
+
+        // Hash的key也采用StringRedisSerializer的序列化方式
+        template.setHashKeySerializer(new StringRedisSerializer());
+        template.setHashValueSerializer(serializer);
+
+        template.afterPropertiesSet();
+        return template;
+    }
+    @Bean
+    public RedisTemplate<String, Boolean> redisTemplateForBoolean(RedisConnectionFactory connectionFactory) {
+        RedisTemplate<String, Boolean> template = new RedisTemplate<>();
+        template.setConnectionFactory(connectionFactory);
+
+        // 使用StringRedisSerializer来序列化和反序列化redis的key值
+        template.setKeySerializer(new StringRedisSerializer());
+        template.setValueSerializer(new GenericToStringSerializer<>(Boolean.class));
+
+        // Hash的key也采用StringRedisSerializer的序列化方式
+        template.setHashKeySerializer(new StringRedisSerializer());
+        template.setHashValueSerializer(new GenericToStringSerializer<>(Boolean.class));
+
+        template.afterPropertiesSet();
+        return template;
+    }
+
+    @Bean
+    @SuppressWarnings(value = { "unchecked", "rawtypes" })
+    public RedisTemplate<String, Object> redisTemplateForObject(RedisConnectionFactory connectionFactory) {
+        RedisTemplate<String, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(connectionFactory);
+
+        FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
+        serializer.setObjectMapper(mapper);
+
+        // 使用StringRedisSerializer来序列化和反序列化redis的key值
+        template.setKeySerializer(new StringRedisSerializer());
+        template.setValueSerializer(serializer);
+
+        // Hash的key也采用StringRedisSerializer的序列化方式
+        template.setHashKeySerializer(new StringRedisSerializer());
+        template.setHashValueSerializer(serializer);
+
+        template.afterPropertiesSet();
+        return template;
+    }
+
+    @Bean
+    public DefaultRedisScript<Long> limitScript()
+    {
+        DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>();
+        redisScript.setScriptText(limitScriptText());
+        redisScript.setResultType(Long.class);
+        return redisScript;
+    }
+
+    /**
+     * 限流脚本
+     */
+    private String limitScriptText()
+    {
+        return "local key = KEYS[1]\n" +
+                "local count = tonumber(ARGV[1])\n" +
+                "local time = tonumber(ARGV[2])\n" +
+                "local current = redis.call('get', key);\n" +
+                "if current and tonumber(current) > count then\n" +
+                "    return current;\n" +
+                "end\n" +
+                "current = redis.call('incr', key)\n" +
+                "if tonumber(current) == 1 then\n" +
+                "    redis.call('expire', key, time)\n" +
+                "end\n" +
+                "return current;";
+    }
+}

+ 65 - 0
fs-ad-api/src/main/java/com/fs/framework/config/ResourcesConfig.java

@@ -0,0 +1,65 @@
+package com.fs.framework.config;
+
+import com.fs.common.config.FSConfig;
+import com.fs.common.constant.Constants;
+import com.fs.framework.interceptor.RepeatSubmitInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 通用配置
+ * 
+
+ */
+@Configuration
+public class ResourcesConfig implements WebMvcConfigurer
+{
+    @Autowired
+    private RepeatSubmitInterceptor repeatSubmitInterceptor;
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry)
+    {
+        /** 本地文件上传路径 */
+        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + FSConfig.getProfile() + "/");
+
+        /** swagger配置 */
+        registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
+    }
+
+    /**
+     * 自定义拦截规则
+     */
+    @Override
+    public void addInterceptors(InterceptorRegistry registry)
+    {
+        registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
+    }
+
+    /**
+     * 跨域配置
+     */
+    @Bean
+    public CorsFilter corsFilter()
+    {
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        CorsConfiguration config = new CorsConfiguration();
+        config.setAllowCredentials(true);
+        // 设置访问源地址
+        config.addAllowedOrigin("*");
+        // 设置访问源请求头
+        config.addAllowedHeader("*");
+        // 设置访问源请求方法
+        config.addAllowedMethod("*");
+        // 对接口配置跨域设置
+        source.registerCorsConfiguration("/**", config);
+        return new CorsFilter(source);
+    }
+}

+ 50 - 0
fs-ad-api/src/main/java/com/fs/framework/config/SecurityConfig.java

@@ -0,0 +1,50 @@
+package com.fs.framework.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.BeanIds;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+/**
+ * spring security配置
+ * 
+
+ */
+@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
+public class SecurityConfig extends WebSecurityConfigurerAdapter
+{
+
+    /**
+     * anyRequest          |   匹配所有请求路径
+     * access              |   SpringEl表达式结果为true时可以访问
+     * anonymous           |   匿名可以访问
+     * denyAll             |   用户不能访问
+     * fullyAuthenticated  |   用户完全认证可以访问(非remember-me下自动登录)
+     * hasAnyAuthority     |   如果有参数,参数表示权限,则其中任何一个权限可以访问
+     * hasAnyRole          |   如果有参数,参数表示角色,则其中任何一个角色可以访问
+     * hasAuthority        |   如果有参数,参数表示权限,则其权限可以访问
+     * hasIpAddress        |   如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问
+     * hasRole             |   如果有参数,参数表示角色,则其角色可以访问
+     * permitAll           |   用户可以任意访问
+     * rememberMe          |   允许通过remember-me登录的用户访问
+     * authenticated       |   用户登录后可访问
+     */
+    @Override
+    protected void configure(HttpSecurity http) throws Exception
+    {
+        http.authorizeRequests()
+                .antMatchers("/**").permitAll()
+                .anyRequest().authenticated()
+                .and().csrf().disable();
+    }
+
+    @Bean(name = BeanIds.AUTHENTICATION_MANAGER)
+    @Override
+    public AuthenticationManager authenticationManagerBean() throws Exception {
+        return super.authenticationManagerBean();
+    }
+
+
+}

+ 33 - 0
fs-ad-api/src/main/java/com/fs/framework/config/ServerConfig.java

@@ -0,0 +1,33 @@
+package com.fs.framework.config;
+
+import com.fs.common.utils.ServletUtils;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 服务相关配置
+ * 
+
+ */
+@Component
+public class ServerConfig
+{
+    /**
+     * 获取完整的请求路径,包括:域名,端口,上下文访问路径
+     * 
+     * @return 服务地址
+     */
+    public String getUrl()
+    {
+        HttpServletRequest request = ServletUtils.getRequest();
+        return getDomain(request);
+    }
+
+    public static String getDomain(HttpServletRequest request)
+    {
+        StringBuffer url = request.getRequestURL();
+        String contextPath = request.getServletContext().getContextPath();
+        return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
+    }
+}

+ 121 - 0
fs-ad-api/src/main/java/com/fs/framework/config/SwaggerConfig.java

@@ -0,0 +1,121 @@
+package com.fs.framework.config;
+
+import com.fs.common.config.FSConfig;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.models.auth.In;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.*;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Swagger2的接口配置
+ * 
+
+ */
+@Configuration
+public class SwaggerConfig
+{
+    /** 系统基础配置 */
+    @Autowired
+    private FSConfig fsConfig;
+
+    /** 是否开启swagger */
+    @Value("${swagger.enabled}")
+    private boolean enabled;
+
+    /** 设置请求的统一前缀 */
+    @Value("${swagger.pathMapping}")
+    private String pathMapping;
+
+    /**
+     * 创建API
+     */
+    @Bean
+    public Docket createRestApi()
+    {
+        return new Docket(DocumentationType.SWAGGER_2)
+                // 是否启用Swagger
+                .enable(enabled)
+                // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
+                .apiInfo(apiInfo())
+                // 设置哪些接口暴露给Swagger展示
+                .select()
+                // 扫描所有有注解的api,用这种方式更灵活
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+                // 扫描指定包中的swagger注解
+                // .apis(RequestHandlerSelectors.basePackage("com.fs.project.tool.swagger"))
+                // 扫描所有 .apis(RequestHandlerSelectors.any())
+                .paths(PathSelectors.any())
+                .build()
+                /* 设置安全模式,swagger可以设置访问token */
+                .securitySchemes(securitySchemes())
+                .securityContexts(securityContexts())
+                .pathMapping(pathMapping);
+    }
+
+    /**
+     * 安全模式,这里指定token通过Authorization头请求头传递
+     */
+    private List<ApiKey> securitySchemes()
+    {
+        List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
+        apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
+        return apiKeyList;
+    }
+
+    /**
+     * 安全上下文
+     */
+    private List<SecurityContext> securityContexts()
+    {
+        List<SecurityContext> securityContexts = new ArrayList<>();
+        securityContexts.add(
+                SecurityContext.builder()
+                        .securityReferences(defaultAuth())
+                        .forPaths(PathSelectors.regex("^(?!auth).*$"))
+                        .build());
+        return securityContexts;
+    }
+
+    /**
+     * 默认的安全上引用
+     */
+    private List<SecurityReference> defaultAuth()
+    {
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+        authorizationScopes[0] = authorizationScope;
+        List<SecurityReference> securityReferences = new ArrayList<>();
+        securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
+        return securityReferences;
+    }
+
+    /**
+     * 添加摘要信息
+     */
+    private ApiInfo apiInfo()
+    {
+        // 用ApiInfoBuilder进行定制
+        return new ApiInfoBuilder()
+                // 设置标题
+                .title("标题:FS管理系统_接口文档")
+                // 描述
+                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+                // 作者信息
+                .contact(new Contact(fsConfig.getName(), null, null))
+                // 版本
+                .version("版本号:" + fsConfig.getVersion())
+                .build();
+    }
+}

+ 63 - 0
fs-ad-api/src/main/java/com/fs/framework/config/ThreadPoolConfig.java

@@ -0,0 +1,63 @@
+package com.fs.framework.config;
+
+import com.fs.common.utils.Threads;
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * 线程池配置
+ *
+
+ **/
+@Configuration
+public class ThreadPoolConfig
+{
+    // 核心线程池大小
+    private int corePoolSize = 50;
+
+    // 最大可创建的线程数
+    private int maxPoolSize = 200;
+
+    // 队列最大长度
+    private int queueCapacity = 1000;
+
+    // 线程池维护线程所允许的空闲时间
+    private int keepAliveSeconds = 300;
+
+    @Bean(name = "threadPoolTaskExecutor")
+    public ThreadPoolTaskExecutor threadPoolTaskExecutor()
+    {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setCorePoolSize(corePoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveSeconds);
+        // 线程池对拒绝任务(无线程可用)的处理策略
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        return executor;
+    }
+
+    /**
+     * 执行周期性或定时任务
+     */
+    @Bean(name = "scheduledExecutorService")
+    protected ScheduledExecutorService scheduledExecutorService()
+    {
+        return new ScheduledThreadPoolExecutor(corePoolSize,
+                new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build())
+        {
+            @Override
+            protected void afterExecute(Runnable r, Throwable t)
+            {
+                super.afterExecute(r, t);
+                Threads.printException(r, t);
+            }
+        };
+    }
+}

+ 77 - 0
fs-ad-api/src/main/java/com/fs/framework/config/properties/DruidProperties.java

@@ -0,0 +1,77 @@
+package com.fs.framework.config.properties;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * druid 配置属性
+ *
+
+ */
+@Configuration
+public class DruidProperties
+{
+    @Value("${spring.datasource.mysql.druid.initialSize}")
+    private int initialSize;
+
+    @Value("${spring.datasource.mysql.druid.minIdle}")
+    private int minIdle;
+
+    @Value("${spring.datasource.mysql.druid.maxActive}")
+    private int maxActive;
+
+    @Value("${spring.datasource.mysql.druid.maxWait}")
+    private int maxWait;
+
+    @Value("${spring.datasource.mysql.druid.timeBetweenEvictionRunsMillis}")
+    private int timeBetweenEvictionRunsMillis;
+
+    @Value("${spring.datasource.mysql.druid.minEvictableIdleTimeMillis}")
+    private int minEvictableIdleTimeMillis;
+
+    @Value("${spring.datasource.mysql.druid.maxEvictableIdleTimeMillis}")
+    private int maxEvictableIdleTimeMillis;
+
+    @Value("${spring.datasource.mysql.druid.validationQuery}")
+    private String validationQuery;
+
+    @Value("${spring.datasource.mysql.druid.testWhileIdle}")
+    private boolean testWhileIdle;
+
+    @Value("${spring.datasource.mysql.druid.testOnBorrow}")
+    private boolean testOnBorrow;
+
+    @Value("${spring.datasource.mysql.druid.testOnReturn}")
+    private boolean testOnReturn;
+
+    public DruidDataSource dataSource(DruidDataSource datasource)
+    {
+        /** 配置初始化大小、最小、最大 */
+        datasource.setInitialSize(initialSize);
+        datasource.setMaxActive(maxActive);
+        datasource.setMinIdle(minIdle);
+
+        /** 配置获取连接等待超时的时间 */
+        datasource.setMaxWait(maxWait);
+
+        /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
+        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+
+        /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
+        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+        datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
+
+        /**
+         * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
+         */
+        datasource.setValidationQuery(validationQuery);
+        /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */
+        datasource.setTestWhileIdle(testWhileIdle);
+        /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
+        datasource.setTestOnBorrow(testOnBorrow);
+        /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
+        datasource.setTestOnReturn(testOnReturn);
+        return datasource;
+    }
+}

+ 27 - 0
fs-ad-api/src/main/java/com/fs/framework/datasource/DynamicDataSource.java

@@ -0,0 +1,27 @@
+package com.fs.framework.datasource;
+
+import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
+
+import javax.sql.DataSource;
+import java.util.Map;
+
+/**
+ * 动态数据源
+ * 
+
+ */
+public class DynamicDataSource extends AbstractRoutingDataSource
+{
+    public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources)
+    {
+        super.setDefaultTargetDataSource(defaultTargetDataSource);
+        super.setTargetDataSources(targetDataSources);
+        super.afterPropertiesSet();
+    }
+
+    @Override
+    protected Object determineCurrentLookupKey()
+    {
+        return DynamicDataSourceContextHolder.getDataSourceType();
+    }
+}

+ 45 - 0
fs-ad-api/src/main/java/com/fs/framework/datasource/DynamicDataSourceContextHolder.java

@@ -0,0 +1,45 @@
+package com.fs.framework.datasource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 数据源切换处理
+ * 
+
+ */
+public class DynamicDataSourceContextHolder
+{
+    public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
+
+    /**
+     * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
+     *  所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
+     */
+    private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
+
+    /**
+     * 设置数据源的变量
+     */
+    public static void setDataSourceType(String dsType)
+    {
+//        log.info("切换到{}数据源", dsType);
+        CONTEXT_HOLDER.set(dsType);
+    }
+
+    /**
+     * 获得数据源的变量
+     */
+    public static String getDataSourceType()
+    {
+        return CONTEXT_HOLDER.get();
+    }
+
+    /**
+     * 清空数据源变量
+     */
+    public static void clearDataSourceType()
+    {
+        CONTEXT_HOLDER.remove();
+    }
+}

+ 56 - 0
fs-ad-api/src/main/java/com/fs/framework/interceptor/RepeatSubmitInterceptor.java

@@ -0,0 +1,56 @@
+package com.fs.framework.interceptor;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.utils.ServletUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+
+/**
+ * 防止重复提交拦截器
+ *
+
+ */
+@Component
+public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
+{
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
+    {
+        if (handler instanceof HandlerMethod)
+        {
+            HandlerMethod handlerMethod = (HandlerMethod) handler;
+            Method method = handlerMethod.getMethod();
+            RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
+            if (annotation != null)
+            {
+                if (this.isRepeatSubmit(request))
+                {
+                    AjaxResult ajaxResult = AjaxResult.error("不允许重复提交,请稍后再试");
+                    ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult));
+                    return false;
+                }
+            }
+            return true;
+        }
+        else
+        {
+            return super.preHandle(request, response, handler);
+        }
+    }
+
+    /**
+     * 验证是否重复提交由子类实现具体的防重复提交的规则
+     *
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    public abstract boolean isRepeatSubmit(HttpServletRequest request);
+}

+ 126 - 0
fs-ad-api/src/main/java/com/fs/framework/interceptor/impl/SameUrlDataInterceptor.java

@@ -0,0 +1,126 @@
+package com.fs.framework.interceptor.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fs.common.constant.Constants;
+import com.fs.common.core.redis.RedisCache;
+import com.fs.common.filter.RepeatedlyRequestWrapper;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.http.HttpHelper;
+import com.fs.framework.interceptor.RepeatSubmitInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 判断请求url和数据是否和上一次相同,
+ * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。
+ * 
+
+ */
+@Component
+public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
+{
+    public final String REPEAT_PARAMS = "repeatParams";
+
+    public final String REPEAT_TIME = "repeatTime";
+
+    // 令牌自定义标识
+    @Value("${token.header}")
+    private String header;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    /**
+     * 间隔时间,单位:秒 默认10秒
+     * 
+     * 两次相同参数的请求,如果间隔时间大于该参数,系统不会认定为重复提交的数据
+     */
+    private int intervalTime = 10;
+
+    public void setIntervalTime(int intervalTime)
+    {
+        this.intervalTime = intervalTime;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public boolean isRepeatSubmit(HttpServletRequest request)
+    {
+        String nowParams = "";
+        if (request instanceof RepeatedlyRequestWrapper)
+        {
+            RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request;
+            nowParams = HttpHelper.getBodyString(repeatedlyRequest);
+        }
+
+        // body参数为空,获取Parameter的数据
+        if (StringUtils.isEmpty(nowParams))
+        {
+            nowParams = JSONObject.toJSONString(request.getParameterMap());
+        }
+        Map<String, Object> nowDataMap = new HashMap<String, Object>();
+        nowDataMap.put(REPEAT_PARAMS, nowParams);
+        nowDataMap.put(REPEAT_TIME, System.currentTimeMillis());
+
+        // 请求地址(作为存放cache的key值)
+        String url = request.getRequestURI();
+
+        // 唯一值(没有消息头则使用请求地址)
+        String submitKey = request.getHeader(header);
+        if (StringUtils.isEmpty(submitKey))
+        {
+            submitKey = url;
+        }
+
+        // 唯一标识(指定key + 消息头)
+        String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey;
+
+        Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
+        if (sessionObj != null)
+        {
+            Map<String, Object> sessionMap = (Map<String, Object>) sessionObj;
+            if (sessionMap.containsKey(url))
+            {
+                Map<String, Object> preDataMap = (Map<String, Object>) sessionMap.get(url);
+                if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap))
+                {
+                    return true;
+                }
+            }
+        }
+        Map<String, Object> cacheMap = new HashMap<String, Object>();
+        cacheMap.put(url, nowDataMap);
+        redisCache.setCacheObject(cacheRepeatKey, cacheMap, intervalTime, TimeUnit.SECONDS);
+        return false;
+    }
+
+    /**
+     * 判断参数是否相同
+     */
+    private boolean compareParams(Map<String, Object> nowMap, Map<String, Object> preMap)
+    {
+        String nowParams = (String) nowMap.get(REPEAT_PARAMS);
+        String preParams = (String) preMap.get(REPEAT_PARAMS);
+        return nowParams.equals(preParams);
+    }
+
+    /**
+     * 判断两次间隔时间
+     */
+    private boolean compareTime(Map<String, Object> nowMap, Map<String, Object> preMap)
+    {
+        long time1 = (Long) nowMap.get(REPEAT_TIME);
+        long time2 = (Long) preMap.get(REPEAT_TIME);
+        if ((time1 - time2) < (this.intervalTime * 1000))
+        {
+            return true;
+        }
+        return false;
+    }
+}

+ 56 - 0
fs-ad-api/src/main/java/com/fs/framework/manager/AsyncManager.java

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

+ 40 - 0
fs-ad-api/src/main/java/com/fs/framework/manager/ShutdownManager.java

@@ -0,0 +1,40 @@
+package com.fs.framework.manager;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PreDestroy;
+
+/**
+ * 确保应用退出时能关闭后台线程
+ *
+
+ */
+@Component
+public class ShutdownManager
+{
+    private static final Logger logger = LoggerFactory.getLogger("sys-user");
+
+    @PreDestroy
+    public void destroy()
+    {
+        shutdownAsyncManager();
+    }
+
+    /**
+     * 停止异步执行任务
+     */
+    private void shutdownAsyncManager()
+    {
+        try
+        {
+            logger.info("====关闭后台任务任务线程池====");
+            AsyncManager.me().shutdown();
+        }
+        catch (Exception e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}

+ 103 - 0
fs-ad-api/src/main/java/com/fs/framework/manager/factory/AsyncFactory.java

@@ -0,0 +1,103 @@
+package com.fs.framework.manager.factory;
+
+import com.fs.common.constant.Constants;
+import com.fs.common.utils.LogUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.ip.AddressUtils;
+import com.fs.common.utils.ip.IpUtils;
+import com.fs.common.utils.spring.SpringUtils;
+import com.fs.system.domain.SysLogininfor;
+import com.fs.system.domain.SysOperLog;
+import com.fs.system.service.ISysLogininforService;
+import com.fs.system.service.ISysOperLogService;
+import eu.bitwalker.useragentutils.UserAgent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.TimerTask;
+
+/**
+ * 异步工厂(产生任务用)
+ * 
+
+ */
+public class AsyncFactory
+{
+    private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");
+
+    /**
+     * 记录登录信息
+     * 
+     * @param username 用户名
+     * @param status 状态
+     * @param message 消息
+     * @param args 列表
+     * @return 任务task
+     */
+    public static TimerTask recordLogininfor(final String username, final String status, final String message,
+            final Object... args)
+    {
+        final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
+        final String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
+        return new TimerTask()
+        {
+            @Override
+            public void run()
+            {
+                String address = AddressUtils.getRealAddressByIP(ip);
+                StringBuilder s = new StringBuilder();
+                s.append(LogUtils.getBlock(ip));
+                s.append(address);
+                s.append(LogUtils.getBlock(username));
+                s.append(LogUtils.getBlock(status));
+                s.append(LogUtils.getBlock(message));
+                // 打印信息到日志
+                sys_user_logger.info(s.toString(), args);
+                // 获取客户端操作系统
+                String os = userAgent.getOperatingSystem().getName();
+                // 获取客户端浏览器
+                String browser = userAgent.getBrowser().getName();
+                // 封装对象
+                SysLogininfor logininfor = new SysLogininfor();
+                logininfor.setUserName(username);
+                logininfor.setIpaddr(ip);
+                logininfor.setLoginLocation(address);
+                logininfor.setBrowser(browser);
+                logininfor.setOs(os);
+                logininfor.setMsg(message);
+                // 日志状态
+                if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
+                {
+                    logininfor.setStatus(Constants.SUCCESS);
+                }
+                else if (Constants.LOGIN_FAIL.equals(status))
+                {
+                    logininfor.setStatus(Constants.FAIL);
+                }
+                // 插入数据
+                SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor);
+            }
+        };
+    }
+
+    /**
+     * 操作日志记录
+     * 
+     * @param operLog 操作日志信息
+     * @return 任务task
+     */
+    public static TimerTask recordOper(final SysOperLog operLog)
+    {
+        return new TimerTask()
+        {
+            @Override
+            public void run()
+            {
+                // 远程查询操作地点
+                operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
+                SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
+            }
+        };
+    }
+}

+ 1 - 0
fs-ad-api/src/main/resources/META-INF/spring-devtools.properties

@@ -0,0 +1 @@
+restart.include.json=/com.alibaba.fastjson.*.jar

+ 127 - 0
fs-ad-api/src/main/resources/application-dev.yml

@@ -0,0 +1,127 @@
+# 数据源配置
+spring:
+    # redis 配置
+    redis:
+        # 地址
+        host: 127.0.0.1
+        # 端口,默认为6379
+        port: 6379
+        # 密码
+        password:
+        # 连接超时时间
+        timeout: 30s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 8
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
+        database: 0
+    datasource:
+        mysql:
+            type: com.alibaba.druid.pool.DruidDataSource
+            driverClassName: com.mysql.cj.jdbc.Driver
+            druid:
+                # 主库数据源
+                master:
+                    url: jdbc:mysql://139.186.77.83:3306/ylrz_scrm?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: Rtroot
+                    password: Rtroot
+                # 从库数据源
+                slave:
+                    # 从数据源开关/默认关闭
+                    enabled: false
+                    url:
+                    username:
+                    password:
+                # 初始连接数
+                initialSize: 5
+                # 最小连接池数量
+                minIdle: 10
+                # 最大连接池数量
+                maxActive: 20
+                # 配置获取连接等待超时的时间
+                maxWait: 60000
+                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+                timeBetweenEvictionRunsMillis: 60000
+                # 配置一个连接在池中最小生存的时间,单位是毫秒
+                minEvictableIdleTimeMillis: 300000
+                # 配置一个连接在池中最大生存的时间,单位是毫秒
+                maxEvictableIdleTimeMillis: 900000
+                # 配置检测连接是否有效
+                validationQuery: SELECT 1 FROM DUAL
+                testWhileIdle: true
+                testOnBorrow: false
+                testOnReturn: false
+                webStatFilter:
+                    enabled: true
+                statViewServlet:
+                    enabled: true
+                    # 设置白名单,不填则允许所有访问
+                    allow:
+                    url-pattern: /druid/*
+                    # 控制台管理用户名和密码
+                    login-username: fs
+                    login-password: 123456
+                filter:
+                    stat:
+                        enabled: true
+                        # 慢SQL记录
+                        log-slow-sql: true
+                        slow-sql-millis: 1000
+                        merge-sql: true
+                    wall:
+                        config:
+                            multi-statement-allow: true
+        sop:
+            type: com.alibaba.druid.pool.DruidDataSource
+            driverClassName: com.mysql.cj.jdbc.Driver
+            druid:
+                # 主库数据源
+                master:
+                    url: jdbc:mysql://139.186.77.83/sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: Rtroot
+                    password: Rtroot
+                # 初始连接数
+                initialSize: 5
+                # 最小连接池数量
+                minIdle: 10
+                # 最大连接池数量
+                maxActive: 20
+                # 配置获取连接等待超时的时间
+                maxWait: 60000
+                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+                timeBetweenEvictionRunsMillis: 60000
+                # 配置一个连接在池中最小生存的时间,单位是毫秒
+                minEvictableIdleTimeMillis: 300000
+                # 配置一个连接在池中最大生存的时间,单位是毫秒
+                maxEvictableIdleTimeMillis: 900000
+                # 配置检测连接是否有效
+                validationQuery: SELECT 1 FROM DUAL
+                testWhileIdle: true
+                testOnBorrow: false
+                testOnReturn: false
+                webStatFilter:
+                    enabled: true
+                statViewServlet:
+                    enabled: true
+                    # 设置白名单,不填则允许所有访问
+                    allow:
+                    url-pattern: /druid/*
+                    # 控制台管理用户名和密码
+                    login-username: fs
+                    login-password: 123456
+                filter:
+                    stat:
+                        enabled: true
+                        # 慢SQL记录
+                        log-slow-sql: true
+                        slow-sql-millis: 1000
+                        merge-sql: true
+                    wall:
+                        config:
+                            multi-statement-allow: true

+ 80 - 0
fs-ad-api/src/main/resources/application-druid.yml

@@ -0,0 +1,80 @@
+# 数据源配置
+spring:
+    # redis 配置
+    redis:
+        # 地址
+        host: 127.0.0.1
+        # 端口,默认为6379
+        port: 6379
+        # 密码
+        password:
+        # 连接超时时间
+        timeout: 30s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 8
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
+        database: 0
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: com.mysql.cj.jdbc.Driver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:mysql://139.186.77.83:3306/bly_store?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: root
+                password: bly@2025
+
+            # 从库数据源
+            slave:
+                # 从数据源开关/默认关闭
+                enabled: false
+                url:
+                username:
+                password:
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter:
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username:
+                login-password:
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true
+

+ 131 - 0
fs-ad-api/src/main/resources/application.yml

@@ -0,0 +1,131 @@
+# 项目相关配置
+fs:
+  # 名称
+  name: fs
+  # 版本
+  version: 1.1.0
+  # 版权年份
+  copyrightYear: 2021
+  # 实例演示开关
+  demoEnabled: true
+  # 文件路径 示例( Windows配置D:/fs/uploadPath,Linux配置 /home/fs/uploadPath)
+  profile: c:/fs/uploadPath
+  # 获取ip地址开关
+  addressEnabled: false
+  # 验证码类型 math 数组计算 char 字符验证
+  captchaType: math
+
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 8008
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # tomcat最大线程数,默认为200
+    max-threads: 800
+    # Tomcat启动初始化的线程数,默认值25
+    min-spare-threads: 30
+
+# 日志配置
+logging:
+  level:
+    com.fs: debug
+    org.springframework: warn
+
+# Spring配置
+spring:
+  # 资源信息
+  messages:
+    # 国际化资源文件路径
+    basename: i18n/messages
+  profiles:
+    active: dev
+    include: config
+  mvc:
+    async:
+      request-timeout: 30000
+
+  # 文件上传
+  servlet:
+     multipart:
+       # 单个文件大小
+       max-file-size:  3GB
+       # 设置总上传的文件大小
+       max-request-size:  3GB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+
+
+# token配置
+token:
+    # 令牌自定义标识
+    header: Authorization
+    # 令牌密钥
+    secret: abcdefghijklmnopqrstuvwxyz
+    # 令牌有效期(默认30分钟)
+    expireTime: 180
+mybatis-plus:
+  # 搜索指定包别名
+  typeAliasesPackage: com.fs.**.domain,com.fs.**.bo
+  # 配置mapper的扫描,找到所有的mapper.xml映射文件
+  mapperLocations: classpath*:/mapper/**/*.xml
+  configLocation: classpath:mybatis/mybatis-config.xml
+  # 全局配置
+  global-config:
+    db-config:
+      # 主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      idType: AUTO
+      # 字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      fieldStrategy: NOT_EMPTY
+    banner: false
+    # 配置
+  configuration:
+    # 驼峰式命名
+    mapUnderscoreToCamelCase: true
+    # 全局映射器启用缓存
+    cacheEnabled: true
+    # 配置默认的执行器
+    defaultExecutorType: REUSE
+    # 允许 JDBC 支持自动生成主键
+    useGeneratedKeys: true
+
+# MyBatis配置
+mybatis:
+    # 搜索指定包别名
+    typeAliasesPackage: com.fs.**.domain
+    # 配置mapper的扫描,找到所有的mapper.xml映射文件
+    mapperLocations: classpath*:mapper/**/*Mapper.xml
+    # 加载全局的配置文件
+    configLocation: classpath:mybatis/mybatis-config.xml
+
+# PageHelper分页插件
+pagehelper:
+  helperDialect: mysql
+  supportMethodsArguments: true
+  params: count=countSql
+
+# Swagger配置
+swagger:
+  # 是否开启swagger
+  enabled: false
+  # 请求前缀
+  pathMapping: /dev-api
+
+# 防止XSS攻击
+xss:
+  # 过滤开关
+  enabled: true
+  # 排除链接(多个用逗号分隔)
+  excludes: /system/notice,/system/config/*
+  # 匹配链接
+  urlPatterns: /system/*,/monitor/*,/tool/*
+zhyf:
+  url: https://zhyf-testController.jingpai.com
+

+ 2 - 0
fs-ad-api/src/main/resources/banner.txt

@@ -0,0 +1,2 @@
+Application Version: ${fs.version}
+Spring Boot Version: ${spring-boot.version}

+ 37 - 0
fs-ad-api/src/main/resources/i18n/messages.properties

@@ -0,0 +1,37 @@
+#错误消息
+not.null=* 必须填写
+user.jcaptcha.error=验证码错误
+user.jcaptcha.expire=验证码已失效
+user.not.exists=用户不存在/密码错误
+user.password.not.match=用户不存在/密码错误
+user.password.retry.limit.count=密码输入错误{0}次
+user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
+user.password.delete=对不起,您的账号已被删除
+user.blocked=用户已封禁,请联系管理员
+role.blocked=角色已封禁,请联系管理员
+user.logout.success=退出成功
+
+length.not.valid=长度必须在{min}到{max}个字符之间
+
+user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
+user.password.not.valid=* 5-50个字符
+ 
+user.email.not.valid=邮箱格式错误
+user.mobile.phone.number.not.valid=手机号格式错误
+user.login.success=登录成功
+user.register.success=注册成功
+user.notfound=请重新登录
+user.forcelogout=管理员强制退出,请重新登录
+user.unknown.error=未知错误,请重新登录
+
+##文件上传消息
+upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
+upload.filename.exceed.length=上传的文件名最长{0}个字符
+
+##权限
+no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
+no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
+no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
+no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
+no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
+no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

+ 15 - 0
fs-ad-api/src/main/resources/mybatis/mybatis-config.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+	
+	<settings>
+		<setting name="cacheEnabled"             value="true" />  <!-- 全局映射器启用缓存 -->
+		<setting name="useGeneratedKeys"         value="true" />  <!-- 允许 JDBC 支持自动生成主键 -->
+		<setting name="defaultExecutorType"      value="REUSE" /> <!-- 配置默认的执行器 -->
+		<setting name="logImpl"                  value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
+		 <setting name="mapUnderscoreToCamelCase" value="true"/>
+	</settings>
+	
+</configuration>

+ 203 - 0
fs-admin/pom.xml

@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+    <parent>
+        <artifactId>fs</artifactId>
+        <groupId>com.fs</groupId>
+        <version>1.1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <artifactId>fs-admin</artifactId>
+    <version>1.1.16</version>
+    <description>
+        后台入口
+    </description>
+
+
+    <dependencies>
+
+        <!-- spring-boot-devtools -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional> <!-- 表示依赖不会传递 -->
+        </dependency>
+
+        <!-- swagger2-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+        </dependency>
+
+        <!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>1.5.21</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-models</artifactId>
+            <version>1.5.21</version>
+        </dependency>
+
+        <!-- swagger2-UI-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+        </dependency>
+
+         <!-- Mysql驱动包 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <!-- SpringBoot Web容器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <!-- SpringBoot 拦截器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <!-- spring security 安全认证 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+
+        <!-- 阿里数据库连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- 验证码 -->
+        <dependency>
+            <groupId>com.github.penggle</groupId>
+            <artifactId>kaptcha</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>javax.servlet-api</artifactId>
+                    <groupId>javax.servlet</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- 获取系统信息 -->
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+        </dependency>
+
+        <!-- 系统模块-->
+        <dependency>
+            <groupId>com.fs</groupId>
+            <artifactId>fs-service-system</artifactId>
+        </dependency>
+
+        <!-- 定时任务-->
+        <dependency>
+            <groupId>com.fs</groupId>
+            <artifactId>fs-service-quartz</artifactId>
+        </dependency>
+
+        <!-- 代码生成-->
+        <dependency>
+            <groupId>com.fs</groupId>
+            <artifactId>fs-service-generator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.javen205</groupId>
+            <artifactId>IJPay-All</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>4.8.62.ALL</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.30</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <configuration>
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                    <warName>${project.artifactId}</warName>
+                </configuration>
+           </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <configuration>
+                    <imageName>${project.artifactId}:${project.version}</imageName>
+                    <baseImage>kdvolder/jdk8</baseImage>
+                    <maintainer>docker_maven docker_maven@email.com</maintainer>
+                    <workdir>/</workdir>
+                    <cmd>["java", "-version"]</cmd>
+                    <entryPoint>["java", "-jar", "${project.build.finalName}.jar"]</entryPoint>
+                    <!-- 这里是复制 jar 包到 docker 容器指定目录配置 -->
+                    <resources>
+                        <resource>
+                            <targetPath>/</targetPath>
+                            <directory>${project.build.directory}</directory>
+                            <include>${project.build.finalName}.jar</include>
+                        </resource>
+                    </resources>
+                    <dockerHost>http://8.140.143.122:2375</dockerHost>
+                </configuration>
+            </plugin>
+
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

+ 36 - 0
fs-admin/src/main/java/com/fs/FSAdminApplication.java

@@ -0,0 +1,36 @@
+package com.fs;
+
+import com.fs.core.security.SecurityUtils;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 启动程序
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@EnableTransactionManagement
+@EnableAsync
+@EnableCaching
+@EnableScheduling
+public class FSAdminApplication
+{
+    public static void main(String[] args)
+    {
+        // System.setProperty("spring.devtools.restart.enabled", "false");
+        SpringApplication.run(FSAdminApplication.class, args);
+        System.out.println("Admin启动成功 \n");
+    }
+}

+ 16 - 0
fs-admin/src/main/java/com/fs/FSServletInitializer.java

@@ -0,0 +1,16 @@
+package com.fs;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+/**
+ * web容器中进行部署
+ */
+public class FSServletInitializer extends SpringBootServletInitializer
+{
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
+    {
+        return application.sources(FSAdminApplication.class);
+    }
+}

+ 29 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdAccountController.java

@@ -0,0 +1,29 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.service.IAdAccountService;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 站点管理Controller
+ * 
+ * @author fs
+ * @date 2025-03-04
+ */
+@RestController
+@RequestMapping("/ad/adAccount")
+public class AdAccountController extends BaseController
+{
+    @Autowired
+    private IAdAccountService adAccountService;
+
+    @GetMapping("/listAll")
+    public R listAll(){
+        return R.ok().put("data", adAccountService.listAll());
+    }
+
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdDomainController.java

@@ -0,0 +1,106 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdDomain;
+import com.fs.ad.service.IAdDomainService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 广告域名Controller
+ * 
+ * @author fs
+ * @date 2025-03-04
+ */
+@RestController
+@RequestMapping("/ad/adDomain")
+public class AdDomainController extends BaseController
+{
+    @Autowired
+    private IAdDomainService adDomainService;
+
+    /**
+     * 查询广告域名列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdDomain adDomain)
+    {
+        startPage();
+        List<AdDomain> list = adDomainService.selectAdDomainList(adDomain);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出广告域名列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:export')")
+    @Log(title = "广告域名", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdDomain adDomain)
+    {
+        List<AdDomain> list = adDomainService.selectAdDomainList(adDomain);
+        ExcelUtil<AdDomain> util = new ExcelUtil<AdDomain>(AdDomain.class);
+        return util.exportExcel(list, "广告域名数据");
+    }
+
+    /**
+     * 获取广告域名详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adDomainService.selectAdDomainById(id));
+    }
+
+    /**
+     * 新增广告域名
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:add')")
+    @Log(title = "广告域名", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdDomain adDomain)
+    {
+        return toAjax(adDomainService.insertAdDomain(adDomain));
+    }
+
+    /**
+     * 修改广告域名
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:edit')")
+    @Log(title = "广告域名", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdDomain adDomain)
+    {
+        return toAjax(adDomainService.updateAdDomain(adDomain));
+    }
+
+    /**
+     * 删除广告域名
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adDomain:remove')")
+    @Log(title = "广告域名", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adDomainService.deleteAdDomainByIds(ids));
+    }
+
+
+
+
+    @GetMapping(value = "/listAll")
+    public R listAll(){
+        return R.ok().put("data", adDomainService.list());
+    }
+}

+ 97 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdHtmlClickLogController.java

@@ -0,0 +1,97 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdHtmlClickLog;
+import com.fs.ad.service.IAdHtmlClickLogService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 广告点击Controller
+ * 
+ * @author fs
+ * @date 2025-01-09
+ */
+@RestController
+@RequestMapping("/ad/clickLog")
+public class AdHtmlClickLogController extends BaseController
+{
+    @Autowired
+    private IAdHtmlClickLogService adHtmlClickLogService;
+
+    /**
+     * 查询广告点击列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdHtmlClickLog adHtmlClickLog)
+    {
+        startPage();
+        List<AdHtmlClickLog> list = adHtmlClickLogService.selectAdHtmlClickLogList(adHtmlClickLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出广告点击列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:export')")
+    @Log(title = "广告点击", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdHtmlClickLog adHtmlClickLog)
+    {
+        List<AdHtmlClickLog> list = adHtmlClickLogService.selectAdHtmlClickLogList(adHtmlClickLog);
+        ExcelUtil<AdHtmlClickLog> util = new ExcelUtil<AdHtmlClickLog>(AdHtmlClickLog.class);
+        return util.exportExcel(list, "广告点击数据");
+    }
+
+    /**
+     * 获取广告点击详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adHtmlClickLogService.selectAdHtmlClickLogById(id));
+    }
+
+    /**
+     * 新增广告点击
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:add')")
+    @Log(title = "广告点击", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdHtmlClickLog adHtmlClickLog)
+    {
+        return toAjax(adHtmlClickLogService.insertAdHtmlClickLog(adHtmlClickLog));
+    }
+
+    /**
+     * 修改广告点击
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:edit')")
+    @Log(title = "广告点击", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdHtmlClickLog adHtmlClickLog)
+    {
+        return toAjax(adHtmlClickLogService.updateAdHtmlClickLog(adHtmlClickLog));
+    }
+
+    /**
+     * 删除广告点击
+     */
+    @PreAuthorize("@ss.hasPermi('ad:clickLog:remove')")
+    @Log(title = "广告点击", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adHtmlClickLogService.deleteAdHtmlClickLogByIds(ids));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdHtmlTemplateController.java

@@ -0,0 +1,103 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdHtmlTemplate;
+import com.fs.ad.service.IAdHtmlTemplateService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 广告信息流链接Controller
+ * 
+ * @author fs
+ * @date 2024-12-31
+ */
+@RestController
+@RequestMapping("/ad/html/template")
+public class AdHtmlTemplateController extends BaseController
+{
+    @Autowired
+    private IAdHtmlTemplateService adHtmlUrlService;
+
+    /**
+     * 查询广告信息流链接列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdHtmlTemplate adHtmlTemplate)
+    {
+        startPage();
+        List<AdHtmlTemplate> list = adHtmlUrlService.selectAdHtmlUrlList(adHtmlTemplate);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出广告信息流链接列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:export')")
+    @Log(title = "广告信息流链接", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdHtmlTemplate adHtmlTemplate)
+    {
+        List<AdHtmlTemplate> list = adHtmlUrlService.selectAdHtmlUrlList(adHtmlTemplate);
+        ExcelUtil<AdHtmlTemplate> util = new ExcelUtil<AdHtmlTemplate>(AdHtmlTemplate.class);
+        return util.exportExcel(list, "广告信息流链接数据");
+    }
+
+    /**
+     * 获取广告信息流链接详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adHtmlUrlService.selectAdHtmlUrlById(id));
+    }
+
+    /**
+     * 新增广告信息流链接
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:add')")
+    @Log(title = "广告信息流链接", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdHtmlTemplate adHtmlTemplate)
+    {
+        return toAjax(adHtmlUrlService.insertAdHtmlUrl(adHtmlTemplate));
+    }
+
+    /**
+     * 修改广告信息流链接
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:edit')")
+    @Log(title = "广告信息流链接", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdHtmlTemplate adHtmlTemplate)
+    {
+        return toAjax(adHtmlUrlService.updateAdHtmlUrl(adHtmlTemplate));
+    }
+
+    /**
+     * 删除广告信息流链接
+     */
+    @PreAuthorize("@ss.hasPermi('ad:html:remove')")
+    @Log(title = "广告信息流链接", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adHtmlUrlService.deleteAdHtmlUrlByIds(ids));
+    }
+
+    @GetMapping(value = "/listAll")
+    public R listAll(){
+        return R.ok().put("data", adHtmlUrlService.list());
+    }
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdIqiyiAccountController.java

@@ -0,0 +1,106 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdIqiyiAccount;
+import com.fs.ad.service.IAdIqiyiAccountService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 爱奇艺广告账号Controller
+ * 
+ * @author fs
+ * @date 2025-03-03
+ */
+@RestController
+@RequestMapping("/ad/AdIqiyiAccount")
+public class AdIqiyiAccountController extends BaseController
+{
+    @Autowired
+    private IAdIqiyiAccountService adIqiyiAccountService;
+
+    /**
+     * 查询爱奇艺广告账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdIqiyiAccount adIqiyiAccount)
+    {
+        startPage();
+        List<AdIqiyiAccount> list = adIqiyiAccountService.selectAdIqiyiAccountList(adIqiyiAccount);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出爱奇艺广告账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:export')")
+    @Log(title = "爱奇艺广告账号", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdIqiyiAccount adIqiyiAccount)
+    {
+        List<AdIqiyiAccount> list = adIqiyiAccountService.selectAdIqiyiAccountList(adIqiyiAccount);
+        ExcelUtil<AdIqiyiAccount> util = new ExcelUtil<AdIqiyiAccount>(AdIqiyiAccount.class);
+        return util.exportExcel(list, "爱奇艺广告账号数据");
+    }
+
+    /**
+     * 获取爱奇艺广告账号详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adIqiyiAccountService.selectAdIqiyiAccountById(id));
+    }
+
+    /**
+     * 新增爱奇艺广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:add')")
+    @Log(title = "爱奇艺广告账号", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdIqiyiAccount adIqiyiAccount)
+    {
+        return toAjax(adIqiyiAccountService.insertAdIqiyiAccount(adIqiyiAccount));
+    }
+
+    /**
+     * 修改爱奇艺广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:edit')")
+    @Log(title = "爱奇艺广告账号", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdIqiyiAccount adIqiyiAccount)
+    {
+        return toAjax(adIqiyiAccountService.updateAdIqiyiAccount(adIqiyiAccount));
+    }
+
+    /**
+     * 删除爱奇艺广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdIqiyiAccount:remove')")
+    @Log(title = "爱奇艺广告账号", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adIqiyiAccountService.deleteAdIqiyiAccountByIds(ids));
+    }
+    /**
+     * 删除优酷广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:list')")
+    @GetMapping("/listAll")
+    public R listAll(){
+        return R.ok().put("data", adIqiyiAccountService.listAll());
+    }
+}

+ 98 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdSiteController.java

@@ -0,0 +1,98 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdSite;
+import com.fs.ad.service.IAdSiteService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 站点管理Controller
+ * 
+ * @author fs
+ * @date 2025-03-04
+ */
+@RestController
+@RequestMapping("/ad/adSite")
+public class AdSiteController extends BaseController
+{
+    @Autowired
+    private IAdSiteService adSiteService;
+
+    /**
+     * 查询站点管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdSite adSite)
+    {
+        startPage();
+        List<AdSite> list = adSiteService.selectAdSiteList(adSite);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出站点管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:export')")
+    @Log(title = "站点管理", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdSite adSite)
+    {
+        List<AdSite> list = adSiteService.selectAdSiteList(adSite);
+        ExcelUtil<AdSite> util = new ExcelUtil<AdSite>(AdSite.class);
+        return util.exportExcel(list, "站点管理数据");
+    }
+
+    /**
+     * 获取站点管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adSiteService.selectAdSiteById(id));
+    }
+
+    /**
+     * 新增站点管理
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:add')")
+    @Log(title = "站点管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdSite adSite)
+    {
+        return toAjax(adSiteService.insertAdSite(adSite));
+    }
+
+    /**
+     * 修改站点管理
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:edit')")
+    @Log(title = "站点管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdSite adSite)
+    {
+        return toAjax(adSiteService.updateAdSite(adSite));
+    }
+
+    /**
+     * 删除站点管理
+     */
+    @PreAuthorize("@ss.hasPermi('ad:adSite:remove')")
+    @Log(title = "站点管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adSiteService.deleteAdSiteByIds(ids));
+    }
+
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/ad/controller/AdYoukuAccountController.java

@@ -0,0 +1,106 @@
+package com.fs.ad.controller;
+
+import com.fs.ad.domain.AdYoukuAccount;
+import com.fs.ad.service.IAdYoukuAccountService;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 优酷广告账号Controller
+ * 
+ * @author fs
+ * @date 2025-02-19
+ */
+@RestController
+@RequestMapping("/ad/AdYouKuAccount")
+public class AdYoukuAccountController extends BaseController
+{
+    @Autowired
+    private IAdYoukuAccountService adYoukuAccountService;
+
+    /**
+     * 查询优酷广告账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AdYoukuAccount adYoukuAccount)
+    {
+        startPage();
+        List<AdYoukuAccount> list = adYoukuAccountService.selectAdYoukuAccountList(adYoukuAccount);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出优酷广告账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:export')")
+    @Log(title = "优酷广告账号", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AdYoukuAccount adYoukuAccount)
+    {
+        List<AdYoukuAccount> list = adYoukuAccountService.selectAdYoukuAccountList(adYoukuAccount);
+        ExcelUtil<AdYoukuAccount> util = new ExcelUtil<AdYoukuAccount>(AdYoukuAccount.class);
+        return util.exportExcel(list, "优酷广告账号数据");
+    }
+
+    /**
+     * 获取优酷广告账号详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(adYoukuAccountService.selectAdYoukuAccountById(id));
+    }
+
+    /**
+     * 新增优酷广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:add')")
+    @Log(title = "优酷广告账号", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdYoukuAccount adYoukuAccount)
+    {
+        return toAjax(adYoukuAccountService.insertAdYoukuAccount(adYoukuAccount));
+    }
+
+    /**
+     * 修改优酷广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:edit')")
+    @Log(title = "优酷广告账号", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdYoukuAccount adYoukuAccount)
+    {
+        return toAjax(adYoukuAccountService.updateAdYoukuAccount(adYoukuAccount));
+    }
+
+    /**
+     * 删除优酷广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:remove')")
+    @Log(title = "优酷广告账号", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(adYoukuAccountService.deleteAdYoukuAccountByIds(ids));
+    }
+    /**
+     * 删除优酷广告账号
+     */
+    @PreAuthorize("@ss.hasPermi('ad:AdYouKuaccount:list')")
+	@GetMapping("/listAll")
+    public R listAll(){
+        return R.ok().put("data", adYoukuAccountService.listAll());
+    }
+}

+ 141 - 0
fs-admin/src/main/java/com/fs/ad/controller/BdAccountController.java

@@ -0,0 +1,141 @@
+package com.fs.ad.controller;
+
+import com.fs.baidu.api.BaiduApis;
+import com.fs.baidu.domain.*;
+import com.fs.baidu.service.*;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * 百度账号Controller
+ * 
+ * @author fs
+ * @date 2025-01-20
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/bd/BdAccount")
+public class BdAccountController extends BaseController {
+    private final IBdAccountService bdAccountService;
+    private final IBdPlanService bdPlanService;
+    private final IBdUnitService bdUnitService;
+    private final IBdCreativeService bdCreativeService;
+    private final IBdApiService bdApiService;
+    private final BaiduApis baiduApis;
+
+    /**
+     * 查询百度账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(BdAccount bdAccount){
+        startPage();
+        List<BdAccount> list = bdAccountService.selectBdAccountList(bdAccount);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出百度账号列表
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:export')")
+    @Log(title = "百度账号", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(BdAccount bdAccount)
+    {
+        List<BdAccount> list = bdAccountService.selectBdAccountList(bdAccount);
+        ExcelUtil<BdAccount> util = new ExcelUtil<BdAccount>(BdAccount.class);
+        return util.exportExcel(list, "百度账号数据");
+    }
+
+    /**
+     * 获取百度账号详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(bdAccountService.selectBdAccountById(id));
+    }
+
+    /**
+     * 新增百度账号
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:add')")
+    @Log(title = "百度账号", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BdAccount bdAccount)
+    {
+        return toAjax(bdAccountService.insertBdAccount(bdAccount));
+    }
+
+    /**
+     * 修改百度账号
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:edit')")
+    @Log(title = "百度账号", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BdAccount bdAccount)
+    {
+        return toAjax(bdAccountService.updateBdAccount(bdAccount));
+    }
+
+    /**
+     * 删除百度账号
+     */
+    @PreAuthorize("@ss.hasPermi('baidu:BdAccount:remove')")
+    @Log(title = "百度账号", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(bdAccountService.deleteBdAccountByIds(ids));
+    }
+
+
+    /**
+     * 查询百度账号列表
+     */
+    @GetMapping("/listAll")
+    public R listAll(BdAccount bdAccount){
+        return R.ok().put("data", bdAccountService.selectBdAccountList(bdAccount));
+    }
+    @GetMapping("/listAllPlan")
+    public R listAllPlan(BdPlan plan){
+        return R.ok().put("data", bdPlanService.selectBdPlanList(plan));
+    }
+    @GetMapping("/listAllUnit")
+    public R listAllUnit(BdUnit unit){
+        return R.ok().put("data", bdUnitService.selectBdUnitList(unit));
+    }
+    @GetMapping("/listAllCreative")
+    public R listAllCreative(BdCreative creative){
+        return R.ok().put("data", bdCreativeService.selectBdCreativeList(creative));
+    }
+    @GetMapping("/authorizationUrl")
+    public R authorizationUrl(Long id){
+        Optional<BdApi> first = bdApiService.list().stream().findFirst();
+        if(!first.isPresent()){
+            return R.error("未找到API信息");
+        }
+        return R.ok().put("url", bdApiService.authorizationUrl(first.get().getId()));
+    }
+    @GetMapping("/syncAccount")
+    public R syncAccount(Long id){
+        Optional<BdApi> first = bdApiService.list().stream().findFirst();
+        if(!first.isPresent()){
+            return R.error("未找到API信息");
+        }
+        baiduApis.listAccount(1L, id);
+        return R.ok();
+    }
+}

+ 215 - 0
fs-admin/src/main/java/com/fs/ad/controller/MockAppController.java

@@ -0,0 +1,215 @@
+package com.fs.ad.controller;
+
+import com.fs.baidu.domain.BdApi;
+import com.fs.baidu.service.IBdApiService;
+import com.fs.baidu.utils.SignService;
+import com.fs.huifuPay.sdk.opps.core.exception.BasePayException;
+import com.fs.huifuPay.sdk.opps.core.utils.HttpClientUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+@Slf4j
+@RestController
+@RequestMapping("/baiduBack")
+public class MockAppController {
+    private static final String APPID = "appId";
+    private static final String AUTH_CODE = "authCode";
+    private static final String USERID = "userId";
+    private static final String TIMESTAMP = "timestamp";
+    private static final String SIGNATURE = "signature";
+    private static final String STATE = "state";
+    private static final String ACCESSTOKEN_URL = "https://u.baidu.com/oauth/accessToken";
+
+    @Autowired
+    private IBdApiService bdApiService; // 开发者自定义
+    @Autowired
+    private SignService signService; // 开发者可自定义
+
+    @GetMapping("/callback")
+    public String mockApp(HttpServletRequest request) throws BasePayException {
+
+        // 获取请求参数
+        Map<String, String> params = new HashMap<>();
+        this.fillParams(params, request);
+        log.info("callback: params = {}", JSONObject.valueToString(params));
+        int userIdInt = 0;
+        try {
+            userIdInt = Integer.parseInt(params.get(USERID));
+        } catch (Exception e) {
+            return this.getResponseJson(600011, "参数错误", new Object());
+        }
+        // 对签名内容进行判空
+        if (StringUtils.isBlank(params.get(SIGNATURE))) {
+            return this.getResponseJson(600011, "参数错误", new Object());
+        }
+
+        // 获取应用对应的密钥
+        BdApi app = bdApiService.getAppByAppId(params.get(APPID));
+        String sk = app.getAppSecretKey();
+        // 开发者进行验签
+        // 检查状态码
+//        if (!this.checkState(params.get(APPID), app.getAppUserId(), params.get(STATE))) {
+//            log.info("callback: state check fail");
+//            return this.getResponseJson(600011, "状态码错误", new Object());
+//        }
+
+        // 签名验证
+        if (!this.checkSignature(params, sk)) {
+            log.info("callback: signature check fail");
+            return this.getResponseJson(600011, "签名错误", new Object());
+        }
+
+        // 调用接口换取授权令牌
+        String response = this.getAccessToken(params, sk, userIdInt);
+        log.info("callback:getAccesstoken, response={}", response);
+        String accessToken = null;
+        String refreshToken = null;
+        int uid;
+
+        if (response.length() > 0) {
+            JSONObject res = new JSONObject(response);
+            int code = (int) res.get("code");
+            if (code == 0) {
+                JSONObject data = res.getJSONObject("data");
+                accessToken = (String) data.get("accessToken");
+                // 注释部分为 accessToken 其他信息,各应用开发者酌情使用即可
+                 refreshToken = (String) data.get("refreshToken");
+                String openId = data.getString("openId");
+                int expiresIn = data.getInt("expiresIn");
+                int refreshExpiresIn = data.getInt("refreshExpiresIn");
+                app.setAccessToken(accessToken);
+                app.setRefreshToken(refreshToken);
+                app.setExpiresIn(expiresIn);
+                app.setOpenId(openId);
+                app.setRefreshExpiresIn(refreshExpiresIn);
+                app.setAuthCode(params.get(AUTH_CODE));
+                bdApiService.updateById(app);
+
+                // TODO 相关信息落库处理
+            } else {
+                return this.getResponseJson(600011, "未获取到 access_token", new Object());
+            }
+        }
+        Map<String, String> data = new HashMap<>();
+        data.put("accessToken", accessToken);
+        return this.getResponseJson(0, "success", data);
+    }
+
+    /**
+     * 填充请求参数,开发者可用实体代替map
+     *
+     * @param params
+     * @param request
+     */
+    private void fillParams(Map<String, String> params, HttpServletRequest request) {
+        params.put(APPID, request.getParameter(APPID));
+        params.put(AUTH_CODE, request.getParameter(AUTH_CODE));
+        params.put(USERID, request.getParameter(USERID));
+        params.put(TIMESTAMP, request.getParameter(TIMESTAMP));
+        params.put(SIGNATURE, request.getParameter(SIGNATURE));
+        params.put(STATE, request.getParameter(STATE));
+    }
+
+    /**
+     * 校验状态码是否符合预期
+     *
+     * @param appId  应用ID
+     * @param userId 创建应用的ID
+     * @param state  请求参数中的状态码
+     * @return
+     */
+    private boolean checkState(String appId, Long userId, String state) {
+        // md5util 开发者自行开发即可
+        String newState = md5(appId.concat("_").concat(String.valueOf(userId)));
+        return newState.equals(state);
+    }
+    public static String md5(String input) {
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] messageDigest = md.digest(input.getBytes());
+            StringBuilder hexString = new StringBuilder();
+            for (byte b : messageDigest) {
+                String hex = Integer.toHexString(0xff & b);
+                if (hex.length() == 1) {
+                    hexString.append('0');
+                }
+                hexString.append(hex);
+            }
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    /**
+     * 签名验证方法
+     *
+     * @param params
+     * @param sk
+     * @return
+     */
+    private boolean checkSignature(Map<String, String> params, String sk) {
+        // 获取验签字符串:按key自然排序,拼接成 json 字符串,
+        // 示例:str1 = {"appId": xxxxx, "authCode": xxx, "state": xxx,"timestamp": xxx}
+        TreeMap<String, Object> map = new TreeMap<>();
+        map.put(APPID, params.get(APPID));
+        map.put(AUTH_CODE, params.get(AUTH_CODE));
+        map.put(USERID, params.get(USERID));
+        map.put(STATE, params.get(STATE));
+        map.put(TIMESTAMP, params.get(TIMESTAMP));
+        // 根据上述签名算法对接收到的参数签名
+        String sign = signService.paramsSign(sk, map);
+        log.info("callback: signature = {}", sign);
+        // 判断签名和URL传参签名是否一致
+        return params.get(SIGNATURE).equals(sign);
+    }
+
+    /**
+     * 换取授权令牌
+     *
+     * @param params
+     * @param sk
+     * @param userIdInt 授权账户ID
+     * @return
+     */
+    private String getAccessToken(Map<String, String> params, String sk, int userIdInt) throws BasePayException {
+        Map<String, Object> requestMap = new HashMap<>();
+        requestMap.put(APPID, params.get(APPID));
+        requestMap.put("secretKey", sk);
+        requestMap.put(AUTH_CODE, params.get(AUTH_CODE));
+        requestMap.put("grantType", "access_token");
+        requestMap.put("userId", userIdInt);
+
+        String paramsJson = JSONObject.valueToString(requestMap);
+        // 开发者自行增加异常判断
+        return HttpClientUtils.httpPostJson(ACCESSTOKEN_URL, new HashMap<>(), paramsJson);
+    }
+
+    /**
+     * 封装返回json串
+     *
+     * @param code
+     * @param message
+     * @param data
+     * @return
+     */
+    private String getResponseJson(int code, String message, Object data) {
+        // 封装返回字段的map
+        Map<String, Object> responseMap = new HashMap<>();
+        responseMap.put("code", code);
+        responseMap.put("message", message);
+        responseMap.put("data", data);
+        return JSONObject.valueToString(responseMap);
+    }
+}

+ 84 - 0
fs-admin/src/main/java/com/fs/ad/controller/StatisticsController.java

@@ -0,0 +1,84 @@
+package com.fs.ad.controller;
+
+import com.fs.baidu.api.BaiduApis;
+import com.fs.baidu.domain.BdAccount;
+import com.fs.baidu.domain.BdApi;
+import com.fs.baidu.enums.BdTimeUnit;
+import com.fs.baidu.mapper.BdApiMapper;
+import com.fs.baidu.param.QueryReportDataParam;
+import com.fs.baidu.service.IBdAccountService;
+import com.fs.bdAdv.param.FsAdvSemStatisticsByDayParam;
+import com.fs.bdAdv.service.IFsAdvSemService;
+import com.fs.bdAdv.vo.FsAdvSemStatisticsByDayVo;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.qw.param.ConversionStatisticsParam;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/baiduStatistics")
+public class StatisticsController extends BaseController {
+
+    private final IFsAdvSemService fsAdvSemService;
+    private final IBdAccountService bdAccountService;
+    private final BaiduApis baiduApis;
+    private final BdApiMapper bdApiMapper;
+
+    @GetMapping("/conversionStatistics")
+    public R conversionStatistics(ConversionStatisticsParam param){
+        return bdAccountService.conversionStatistics(param);
+    }
+
+
+    @GetMapping("/selectFsAdvSemStatisticsByDayVo")
+    public TableDataInfo selectFsAdvSemStatisticsByDayVo(FsAdvSemStatisticsByDayParam param){
+        startPage();
+        return getDataTable(fsAdvSemService.selectFsAdvSemStatisticsByDayVo(param));
+    }
+
+    /**
+     * 导出
+     * @param param
+     * @return
+     */
+    @GetMapping("/fsAdvSemStatisticsExport")
+    public AjaxResult fsAdvSemStatisticsExport(FsAdvSemStatisticsByDayParam param){
+        List<FsAdvSemStatisticsByDayVo> list = fsAdvSemService.selectFsAdvSemStatisticsByDayVo(param);
+        ExcelUtil<FsAdvSemStatisticsByDayVo> util = new ExcelUtil<FsAdvSemStatisticsByDayVo>(FsAdvSemStatisticsByDayVo.class);
+        return util.exportExcel(list, "企微主体数据");
+    }
+
+
+
+    @GetMapping("/getReportData")
+    public R getReportData(Long id, Integer reportType, LocalDate startDate, LocalDate endDate, Integer page, Integer rowCount){
+        QueryReportDataParam param = new QueryReportDataParam();
+        param.setReportType(reportType);
+        param.setStartDate(startDate);
+        param.setEndDate(endDate);
+        param.setPage(page);
+        param.setRowCount(rowCount);
+        param.setTimeUnit(BdTimeUnit.SUMMARY);
+        BdAccount account = bdAccountService.getById(id);
+        BdApi byId = bdApiMapper.selectById(account.getApiId());
+        return baiduApis.getReportData(byId.getAccessToken(), account.getAccountName(), param);
+//        return R.ok();
+    }
+
+    @GetMapping("/bdDataStatic")
+    public R bdDataStatic(){
+        return baiduApis.bdDataStatic();
+    }
+
+
+}

+ 32 - 0
fs-admin/src/main/java/com/fs/ad/controller/task/BaiduTask.java

@@ -0,0 +1,32 @@
+package com.fs.ad.controller.task;
+
+import com.fs.ad.service.IBdReportDataService;
+import com.fs.qw.service.IQwWorkUserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDate;
+
+@Slf4j
+@Component("baiduTask")
+public class BaiduTask {
+
+    @Autowired
+    private IQwWorkUserService qwWorkUserService;
+    @Autowired
+    private IBdReportDataService bdReportDataService;
+
+    /**
+     * 同步完企微客户,然后对加微的数据信息筛选并上传给百度进行投流优化
+     */
+    public void bdUpload(){
+        qwWorkUserService.uploadBd();
+//        qwWorkUserService.uploadYk();
+    }
+    public void syncReportData(){
+        bdReportDataService.syncReportData(LocalDate.now().minusDays(1));
+    }
+
+
+}

+ 71 - 0
fs-admin/src/main/java/com/fs/api/controller/CompanyAPIController.java

@@ -0,0 +1,71 @@
+package com.fs.api.controller;
+
+import com.fs.api.param.ExpressParam;
+import com.fs.api.param.OrderListParam;
+import com.fs.api.vo.ExpressVO;
+import com.fs.api.vo.OrderListVO;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
+import com.fs.company.domain.Company;
+import com.fs.company.service.ICompanyService;
+import com.fs.store.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * 订单Controller
+ *
+ * @author fs
+ * @date 2022-03-15
+ */
+@RestController
+@RequestMapping("/api")
+public class CompanyAPIController extends BaseController
+{
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private IFsStoreOrderService storeOrderService;
+    @Autowired
+    private IFsExpressService expressService;
+
+    private Company checkCompany(HttpServletRequest request){
+        String appId=request.getHeader("appId");
+        String appKey=request.getHeader("appKey");
+        if(appId==null){
+            throw new CustomException("appId不能为空");
+        }
+        if(appKey==null){
+            throw new CustomException("appKey不能为空");
+        }
+        Company company=companyService.selectCompanyByAppId(appId);
+        if(company==null){
+            throw new CustomException("appId不存在");
+        }
+        return company;
+    }
+
+    @GetMapping("/getOrderList")
+    public R getOrderList(OrderListParam param, HttpServletRequest request)
+    {
+        Company company=checkCompany(request);
+        param.setCompanyId(company.getCompanyId());
+        List<OrderListVO> list = storeOrderService.selectCompanyStoreOrderListAPI(param);
+        return R.ok().put("data",list);
+    }
+
+
+    @GetMapping("/getExpressInfo")
+    public R getExpressInfo(ExpressParam param, HttpServletRequest request) {
+        Company company=checkCompany(request);
+        List<ExpressVO> list = expressService.getExpressInfoAPI(param);
+        return R.ok().put("data",list);
+    }
+
+
+
+}

+ 175 - 0
fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java

@@ -0,0 +1,175 @@
+package com.fs.api.controller;
+
+import com.fs.common.core.redis.RedisCache;
+import com.fs.statis.StatisticsRedisConstant;
+import com.fs.statis.dto.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.fs.common.core.domain.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.fs.statis.StatisticsRedisConstant.*;
+
+/**
+ * 首页-统计
+ */
+@RestController
+@RequestMapping("/index/statistics")
+public class IndexStatisticsController {
+    @Autowired
+    private RedisCache redisCache;
+    /**
+     * 分析概览
+     */
+    @PostMapping("/analysisPreview")
+    public R analysisPreview(@RequestBody AnalysisPreviewQueryDTO param){
+        AnalysisPreviewDTO analysisPreviewDTO = null;
+        Integer type = param.getType();
+        Integer userType = param.getUserType();
+
+        if(type == null) {
+            type = 0;
+        }
+
+        if(userType == null) {
+            userType = 0;
+        }
+        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType));
+
+        return R.ok().put("data",analysisPreviewDTO);
+    }
+
+
+    /**
+     * 消费余额
+     */
+    @GetMapping("/rechargeComsumption")
+    public R rechargeComsumption(){
+        ConsumptionBalanceDataDTO consumptionBalanceDataDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_BALANCE);
+
+        return R.ok().put("data", consumptionBalanceDataDTO);
+    }
+
+    /**
+     * 获取统计流量
+     * @return
+     */
+    @GetMapping("/trafficLog")
+    public R getTrafficLog(){
+        TrafficLogDTO trafficLogDTO = redisCache.getCacheObject(DATA_OVERVIEW_TRAFFIC_LOG);
+        return R.ok().put("data",trafficLogDTO);
+    }
+
+    /**
+     * 观看趋势
+     */
+    @PostMapping("/watchEndPlayTrend")
+    public R watchEndPlayTrend(@RequestBody AnalysisPreviewQueryDTO param){
+        Integer type = param.getType();
+        Integer userType = param.getUserType();
+
+        if(type == null) {
+            type = 0;
+        }
+        if(userType == null){
+            userType = 0;
+        }
+        String key = String.format("%s:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType);
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key);
+        return R.ok().put("data", deaMemberTopTenDTOS);
+    }
+
+    /**
+     * 经销商会员观看
+     */
+    @PostMapping("/deaMemberTopTen")
+    public R deaMemberTopTen(@RequestBody AnalysisPreviewQueryDTO param){
+        Integer type = param.getType();
+        Integer statisticalType = param.getStatisticalType();
+        Integer userType = param.getUserType();
+
+        if(type == null) {
+            type = 0;
+        }
+        if(userType == null){
+            userType = 0;
+        }
+
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType));
+        if(deaMemberTopTenDTOS == null){
+            deaMemberTopTenDTOS = new ArrayList<>();
+        }
+        return R.ok().put("data", deaMemberTopTenDTOS);
+    }
+
+    /**
+     * 奖励金额top10
+     */
+    @PostMapping("/rewardMoneyTopTen")
+    public R rewardMoneyTopTen(@RequestBody AnalysisPreviewQueryDTO param){
+        Integer type = param.getType();
+        Integer dataType = param.getDataType();
+        Integer userType = param.getUserType();
+
+        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType));
+        return R.ok().put("data", rewardMoneyTopTenDTOS);
+    }
+
+    /**
+     * 答题红包金额趋势图
+     */
+    @PostMapping("/rewardMoneyTrend")
+    public R rewardMoneyTrend(@RequestBody AnalysisPreviewQueryDTO param){
+        Integer type = param.getType();
+        Integer userType = param.getUserType();
+        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType));
+        return R.ok().put("data", rewardMoneyTrendDTOS);
+    }
+
+    /**
+     * 课程观看top10
+     */
+    @PostMapping("/watchCourseTopTen")
+    public R watchCourseTopTen(@RequestBody AnalysisPreviewQueryDTO param){
+        Integer type = param.getType();
+        String sort = param.getSort();
+        Integer statisticalType = param.getStatisticalType();
+        Integer userType = param.getUserType();
+
+        List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort));
+        return R.ok().put("data", courseStatsDTOS);
+    }
+
+    /**
+     * 数据概览
+     */
+    @GetMapping("/dealerAggregated")
+    public R dealerAggregated(){
+        DealerAggregatedDTO dealerAggregatedDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AGGREGATED);
+
+        return R.ok().put("data",dealerAggregatedDTO);
+    }
+
+    /**
+     * 短信余额
+     */
+    @GetMapping("/smsBalance")
+    public R smsBalance(){
+        Long smsBalance = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_SMS_BALANCE);
+
+        return R.ok().put("data", smsBalance);
+    }
+
+
+    /**
+     * 授权信息
+     */
+    @GetMapping("/authorizationInfo")
+    public R authorizationInfo(){
+        AuthorizationInfoDTO authorizationInfoDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AUTHORIZATION_INFO);
+
+        return R.ok().put("data", authorizationInfoDTO);
+    }
+}

+ 258 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyController.java

@@ -0,0 +1,258 @@
+package com.fs.company.controller;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import cn.hutool.core.util.IdUtil;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.OrderUtils;
+import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.sign.Md5Utils;
+import com.fs.company.domain.*;
+import com.fs.company.param.CompanyDeductParam;
+import com.fs.company.param.CompanyParam;
+import com.fs.company.param.CompanyRechargeParam;
+import com.fs.company.param.CompanyVoiceCallerParam;
+import com.fs.company.service.*;
+import com.fs.company.vo.CompanyCrmVO;
+import com.fs.company.vo.CompanyVO;
+import com.fs.company.vo.CompanyVoiceCallerListVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.security.SecurityUtils;
+import com.fs.core.web.service.TokenService;
+import com.fs.his.vo.OptionsVO;
+import lombok.Synchronized;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+import javax.swing.*;
+
+/**
+ * 企业Controller
+ *
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/company")
+public class CompanyController extends BaseController
+{
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ICompanyUserService userService;
+    @Autowired
+    private ICompanyRechargeService rechargeService;
+    @Autowired
+    private ICompanyDeductService deductService;
+    @Autowired
+    private ICompanyVoiceCallerService callerService;
+    /**
+     * 查询企业列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyParam param) throws ParseException {
+        startPage();
+        List<CompanyVO> list = companyService.selectCompanyVOList(param);
+        for (CompanyVO vo : list){
+            vo.setCompanyMobile(ParseUtils.parsePhone(vo.getCompanyMobile()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出企业列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:export')")
+    @Log(title = "企业", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyParam company)
+    {
+        List<CompanyVO> list = companyService.selectCompanyVOList(company);
+        ExcelUtil<CompanyVO> util = new ExcelUtil<CompanyVO>(CompanyVO.class);
+        return util.exportExcel(list, "company");
+    }
+
+    /**
+     * 获取企业详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:query')")
+    @GetMapping(value = "/{companyId}")
+    public AjaxResult getInfo(@PathVariable("companyId") Long companyId)
+    {
+        return AjaxResult.success(companyService.selectCompanyById(companyId));
+    }
+
+    /**
+     * 新增企业
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:add')")
+    @Log(title = "企业", businessType = BusinessType.INSERT)
+    @PostMapping
+    public R add(@RequestBody Company company)
+    {
+        company.setPassword(SecurityUtils.encryptPassword(company.getPassword()));
+        company.setAppId(Md5Utils.hash(company.getUserName()));
+        company.setAppKey(Md5Utils.hash(company.getPassword()));
+        return companyService.insertCompany(company);
+    }
+
+    /**
+     * 修改企业
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:edit')")
+    @Log(title = "企业", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody Company company)
+    {
+        CompanyUser companyUser = new CompanyUser();
+        if (company.getStatus()==0){
+            companyUser.setStatus("1");
+            companyUser.setCompanyId(company.getCompanyId());
+//            companyUser.setUserType("00");
+            userService.updateAllCompanyUser(companyUser);
+            CompanyVoiceCallerParam param = new CompanyVoiceCallerParam();
+            param.setCompanyId(company.getCompanyId());
+            List<CompanyVoiceCallerListVO> list = callerService.selectCompanyVoiceCallerListVO(param);
+            for (CompanyVoiceCallerListVO vo : list){
+                CompanyVoiceCaller caller=callerService.selectCompanyVoiceCallerById(vo.getCallerId());
+                caller.setCompanyId(0L);
+                caller.setCompanyUserId(0L);
+                caller.setMobile("");
+                caller.setStatus(1);
+                callerService.updateCompanyVoiceCaller(caller);
+            }
+        }else {
+            CompanyUser companyUser1 = userService.selectCompanyUserAdminByCompanyId(company.getCompanyId());
+            companyUser1.setStatus("0");
+            userService.updateCompanyUser(companyUser1);
+        }
+        return toAjax(companyService.updateCompany(company));
+    }
+
+
+
+    /**
+     * 删除企业
+     */
+    @PreAuthorize("@ss.hasPermi('company:company:remove')")
+    @Log(title = "企业", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{companyIds}")
+    public AjaxResult remove(@PathVariable Long[] companyIds)
+    {
+        return toAjax(companyService.deleteCompanyByIds(companyIds));
+    }
+
+    @GetMapping("/getCompanyList")
+    public R getCompanyList()
+    {
+        Company map=new Company();
+        map.setIsDel(0);
+        List<Company> list = companyService.selectCompanyList(map);
+        return R.ok().put("data",list);
+    }
+
+//  @PreAuthorize("@ss.hasPermi('company:company:crmDayCountlist')")
+    @GetMapping("/crmDayCountlist")
+    public TableDataInfo companyCrmDayCountList(CompanyParam param)
+    {
+        startPage();
+        List<CompanyCrmVO> list = companyService.selectCompanyCrmDayCountList(param);
+        return getDataTable(list);
+    }
+
+
+
+    @PreAuthorize("@ss.hasPermi('company:company:resetPwd')")
+    @PostMapping("/resetPwd/{companyId}")
+    public AjaxResult resetPwd(@PathVariable Long companyId)
+    {
+        Company company=companyService.selectCompanyById(companyId);
+        return toAjax(userService.resetUserPwdByUserId(company.getUserId(),SecurityUtils.encryptPassword("123456")));
+    }
+
+//    @PreAuthorize("@ss.hasPermi('company:company:resetMoney')")
+//    @PostMapping("/resetMoney/{companyId}")
+//    public R resetMoney(@PathVariable Long companyId)
+//    {
+//        //companyService.resetMoney(companyId);
+//        return R.ok("功能已停用");
+//    }
+
+
+    @PreAuthorize("@ss.hasPermi('company:company:recharge')")
+    @Log(title = "企业转账", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/recharge")
+    @Transactional
+    @RepeatSubmit
+    public R recharge(@RequestBody CompanyRechargeParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyRecharge recharge=new CompanyRecharge();
+        String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
+        recharge.setRechargeNo(orderSn);
+        recharge.setCompanyId(param.getCompanyId());
+        recharge.setMoney(param.getMoney());
+        recharge.setCreateUserId(loginUser.getUser().getUserId());
+        recharge.setIsAudit(0);
+        recharge.setStatus(0);
+        recharge.setRemark(param.getRemark());
+        recharge.setPayType(3);
+        rechargeService.insertCompanyRecharge(recharge);
+        return R.ok("提交成功,等待审核");
+
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:company:deduct')")
+    @Log(title = "企业扣款", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/deduct")
+    @Transactional
+    @RepeatSubmit
+    public R deduct(@RequestBody CompanyDeductParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyDeduct deduct=new CompanyDeduct();
+        String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
+        deduct.setDeductNo(orderSn);
+        deduct.setCompanyId(param.getCompanyId());
+        deduct.setMoney(param.getMoney());
+        deduct.setCreateUserId(loginUser.getUser().getUserId());
+        deduct.setIsAudit(0);
+        deduct.setRemark(param.getRemark());
+        deductService.insertCompanyDeduct(deduct);
+        return R.ok("提交成功,等待审核");
+    }
+
+    @GetMapping("/allList")
+    public TableDataInfo allList()
+    {
+        List<OptionsVO> list = companyService.selectAllCompanyList();
+        return getDataTable(list);
+    }
+
+
+}

+ 158 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyDeductController.java

@@ -0,0 +1,158 @@
+package com.fs.company.controller;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyMoneyLogs;
+import com.fs.company.domain.CompanyRecharge;
+import com.fs.company.service.ICompanyMoneyLogsService;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.CompanyDeductExportVO;
+import com.fs.company.vo.CompanyDeductVO;
+import com.fs.company.vo.CompanyRechargeVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import lombok.Synchronized;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyDeduct;
+import com.fs.company.service.ICompanyDeductService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 扣款Controller
+ *
+ * @author fs
+ * @date 2023-02-27
+ */
+@RestController
+@RequestMapping("/company/companyDeduct")
+public class CompanyDeductController extends BaseController
+{
+    @Autowired
+    private ICompanyDeductService companyDeductService;
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ICompanyMoneyLogsService moneyLogsService;
+    /**
+     * 查询扣款列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyDeduct companyDeduct)
+    {
+        startPage();
+        List<CompanyDeductVO> list = companyDeductService.selectCompanyDeductVOList(companyDeduct);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出扣款列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:export')")
+    @Log(title = "扣款", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyDeduct companyDeduct)
+    {
+        List<CompanyDeductExportVO> list = companyDeductService.selectCompanyExportDeductList(companyDeduct);
+        ExcelUtil<CompanyDeductExportVO> util = new ExcelUtil<CompanyDeductExportVO>(CompanyDeductExportVO.class);
+        return util.exportExcel(list, "companyDeduct");
+    }
+
+    /**
+     * 获取扣款详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:query')")
+    @GetMapping(value = "/{deductId}")
+    public AjaxResult getInfo(@PathVariable("deductId") Long deductId)
+    {
+        return AjaxResult.success(companyDeductService.selectCompanyDeductById(deductId));
+    }
+
+    /**
+     * 新增扣款
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:add')")
+    @Log(title = "扣款", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyDeduct companyDeduct)
+    {
+        return toAjax(companyDeductService.insertCompanyDeduct(companyDeduct));
+    }
+
+    /**
+     * 修改扣款
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:edit')")
+    @Log(title = "扣款", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyDeduct companyDeduct)
+    {
+        return toAjax(companyDeductService.updateCompanyDeduct(companyDeduct));
+    }
+
+    /**
+     * 删除扣款
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:remove')")
+    @Log(title = "扣款", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{deductIds}")
+    public AjaxResult remove(@PathVariable Long[] deductIds)
+    {
+        return toAjax(companyDeductService.deleteCompanyDeductByIds(deductIds));
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('company:companyDeduct:audit')")
+    @PostMapping("/audit")
+    @Transactional
+    public R audit(@RequestBody CompanyDeduct param)
+    {
+        CompanyDeduct deduct=companyDeductService.selectCompanyDeductById(param.getDeductId());
+        if(deduct.getIsAudit()!=0){
+            return R.error("非法操作");
+        }
+        deduct.setIsAudit(param.getIsAudit());
+        deduct.setRemark(param.getRemark());
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if(deduct.getIsAudit()==1){
+            Company company=companyService.selectCompanyByIdForUpdate(deduct.getCompanyId());
+            company.setMoney(company.getMoney().subtract(deduct.getMoney()));
+            companyService.updateCompany(company);
+            CompanyMoneyLogs log=new CompanyMoneyLogs();
+            log.setCompanyId(deduct.getCompanyId());
+            log.setMoney(deduct.getMoney().multiply(new BigDecimal(-1)));
+            log.setRemark(deduct.getRemark());
+            log.setLogsType(2);
+            log.setBalance(company.getMoney());
+            log.setCreateTime(new Date());
+            moneyLogsService.insertCompanyMoneyLogs(log);
+        }
+        deduct.setAuditTime(new Date());
+        deduct.setAuditUserId(loginUser.getUser().getUserId());
+        companyDeductService.updateCompanyDeduct(deduct);
+        return R.ok("操作成功");
+
+    }
+}

+ 112 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyDeptController.java

@@ -0,0 +1,112 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.utils.ServletUtils;
+import com.fs.core.security.LoginUser;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyDept;
+import com.fs.company.service.ICompanyDeptService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+
+@RestController
+@RequestMapping("/company/companyDept")
+public class CompanyDeptController extends BaseController
+{
+    @Autowired
+    private ICompanyDeptService companyDeptService;
+
+    /**
+     * 查询部门列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyDept companyDept)
+    {
+        startPage();
+        List<CompanyDept> list = companyDeptService.selectCompanyDeptList(companyDept);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出部门列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:export')")
+    @Log(title = "部门", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyDept companyDept)
+    {
+        List<CompanyDept> list = companyDeptService.selectCompanyDeptList(companyDept);
+        ExcelUtil<CompanyDept> util = new ExcelUtil<CompanyDept>(CompanyDept.class);
+        return util.exportExcel(list, "companyDept");
+    }
+
+    /**
+     * 获取部门详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:query')")
+    @GetMapping(value = "/{deptId}")
+    public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
+    {
+        return AjaxResult.success(companyDeptService.selectCompanyDeptById(deptId));
+    }
+
+    /**
+     * 新增部门
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:add')")
+    @Log(title = "部门", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyDept companyDept)
+    {
+        return toAjax(companyDeptService.insertCompanyDept(companyDept));
+    }
+
+    /**
+     * 修改部门
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:edit')")
+    @Log(title = "部门", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyDept companyDept)
+    {
+        return toAjax(companyDeptService.updateCompanyDept(companyDept));
+    }
+
+    /**
+     * 删除部门
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyDept:remove')")
+    @Log(title = "部门", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{deptIds}")
+    public AjaxResult remove(@PathVariable Long[] deptIds)
+    {
+        return toAjax(companyDeptService.deleteCompanyDeptByIds(deptIds));
+    }
+
+    /**
+     * 获取部门下拉树列表
+     */
+    @GetMapping("/treeselect")
+    public AjaxResult treeselect(CompanyDept dept)
+    {
+        dept.setStatus("0");
+        List<CompanyDept> depts = companyDeptService.selectCompanyDeptList(dept);
+        return AjaxResult.success(companyDeptService.buildDeptTreeSelect(depts));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyLogininforController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyLogininfor;
+import com.fs.company.service.ICompanyLogininforService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 系统访问记录Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyLogininfor")
+public class CompanyLogininforController extends BaseController
+{
+    @Autowired
+    private ICompanyLogininforService companyLogininforService;
+
+    /**
+     * 查询系统访问记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyLogininfor companyLogininfor)
+    {
+        startPage();
+        List<CompanyLogininfor> list = companyLogininforService.selectCompanyLogininforList(companyLogininfor);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出系统访问记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:export')")
+    @Log(title = "系统访问记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyLogininfor companyLogininfor)
+    {
+        List<CompanyLogininfor> list = companyLogininforService.selectCompanyLogininforList(companyLogininfor);
+        ExcelUtil<CompanyLogininfor> util = new ExcelUtil<CompanyLogininfor>(CompanyLogininfor.class);
+        return util.exportExcel(list, "companyLogininfor");
+    }
+
+    /**
+     * 获取系统访问记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:query')")
+    @GetMapping(value = "/{infoId}")
+    public AjaxResult getInfo(@PathVariable("infoId") Long infoId)
+    {
+        return AjaxResult.success(companyLogininforService.selectCompanyLogininforById(infoId));
+    }
+
+    /**
+     * 新增系统访问记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:add')")
+    @Log(title = "系统访问记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyLogininfor companyLogininfor)
+    {
+        return toAjax(companyLogininforService.insertCompanyLogininfor(companyLogininfor));
+    }
+
+    /**
+     * 修改系统访问记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:edit')")
+    @Log(title = "系统访问记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyLogininfor companyLogininfor)
+    {
+        return toAjax(companyLogininforService.updateCompanyLogininfor(companyLogininfor));
+    }
+
+    /**
+     * 删除系统访问记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:remove')")
+    @Log(title = "系统访问记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{infoIds}")
+    public AjaxResult remove(@PathVariable Long[] infoIds)
+    {
+        return toAjax(companyLogininforService.deleteCompanyLogininforByIds(infoIds));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyMenuController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyMenu;
+import com.fs.company.service.ICompanyMenuService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 菜单权限Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyMenu")
+public class CompanyMenuController extends BaseController
+{
+    @Autowired
+    private ICompanyMenuService companyMenuService;
+
+    /**
+     * 查询菜单权限列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyMenu companyMenu)
+    {
+        startPage();
+        List<CompanyMenu> list = companyMenuService.selectCompanyMenuList(companyMenu);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出菜单权限列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:export')")
+    @Log(title = "菜单权限", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyMenu companyMenu)
+    {
+        List<CompanyMenu> list = companyMenuService.selectCompanyMenuList(companyMenu);
+        ExcelUtil<CompanyMenu> util = new ExcelUtil<CompanyMenu>(CompanyMenu.class);
+        return util.exportExcel(list, "companyMenu");
+    }
+
+    /**
+     * 获取菜单权限详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:query')")
+    @GetMapping(value = "/{menuId}")
+    public AjaxResult getInfo(@PathVariable("menuId") Long menuId)
+    {
+        return AjaxResult.success(companyMenuService.selectCompanyMenuById(menuId));
+    }
+
+    /**
+     * 新增菜单权限
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:add')")
+    @Log(title = "菜单权限", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyMenu companyMenu)
+    {
+        return toAjax(companyMenuService.insertCompanyMenu(companyMenu));
+    }
+
+    /**
+     * 修改菜单权限
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:edit')")
+    @Log(title = "菜单权限", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyMenu companyMenu)
+    {
+        return toAjax(companyMenuService.updateCompanyMenu(companyMenu));
+    }
+
+    /**
+     * 删除菜单权限
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMenu:remove')")
+    @Log(title = "菜单权限", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{menuIds}")
+    public AjaxResult remove(@PathVariable Long[] menuIds)
+    {
+        return toAjax(companyMenuService.deleteCompanyMenuByIds(menuIds));
+    }
+}

+ 147 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyMoneyLogsController.java

@@ -0,0 +1,147 @@
+package com.fs.company.controller;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.Company;
+
+import com.fs.company.param.CompanyMoneyLogsParam;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.CompanyMoneyLogsExport1VO;
+import com.fs.company.vo.CompanyMoneyLogsExport2VO;
+import com.fs.company.vo.CompanyMoneyLogsExportVO;
+import com.fs.company.vo.CompanyMoneyLogsVO;
+import com.fs.voice.utils.StringUtil;
+import org.aspectj.weaver.loadtime.Aj;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyMoneyLogs;
+import com.fs.company.service.ICompanyMoneyLogsService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 企业账户记录Controller
+ *
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyMoneyLogs")
+public class CompanyMoneyLogsController extends BaseController
+{
+    @Autowired
+    private ICompanyMoneyLogsService companyMoneyLogsService;
+    @Autowired
+    private ICompanyService companyService;
+    /**
+     * 查询企业账户记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMoneyLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyMoneyLogsParam companyMoneyLogs)
+    {
+        startPage();
+        if(companyMoneyLogs.getLogsType()!=null){
+            if(companyMoneyLogs.getLogsType()==4 || companyMoneyLogs.getLogsType()==5){
+                List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsMallVOList(companyMoneyLogs);
+                return getDataTable(list);
+            }
+            if(companyMoneyLogs.getLogsType()==8 || companyMoneyLogs.getLogsType()==9){
+                List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsMallVO1List(companyMoneyLogs);
+                return getDataTable(list);
+            }
+        }
+        List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsVOList(companyMoneyLogs);
+        return getDataTable(list);
+    }
+
+
+    //转账记录
+    @PreAuthorize("@ss.hasPermi('company:companyMoneyLogs:list1')")
+    @GetMapping("/list1")
+
+    public TableDataInfo list1(CompanyMoneyLogsParam companyMoneyLogs)
+    {
+        startPage();
+        companyMoneyLogs.setLogsType(1);
+        List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsVOList(companyMoneyLogs);
+        return getDataTable(list);
+    }
+    //转账记录
+    @PreAuthorize("@ss.hasPermi('company:companyMoneyLogs:list2')")
+    @GetMapping("/list2")
+
+    public TableDataInfo list2(CompanyMoneyLogsParam companyMoneyLogs) {
+        startPage();
+        companyMoneyLogs.setLogsType(2);
+        List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsVOList(companyMoneyLogs);
+        return getDataTable(list);
+    }
+    //扣款
+    @PreAuthorize("@ss.hasPermi('company:companyMoneyLogs:list3')")
+    @GetMapping("/list3")
+    public TableDataInfo list3(CompanyMoneyLogsParam companyMoneyLogs) {
+        startPage();
+        companyMoneyLogs.setLogsType(3);
+        List<CompanyMoneyLogsVO> list = companyMoneyLogsService.selectCompanyMoneyLogsVOList(companyMoneyLogs);
+        return getDataTable(list);
+    }
+    /**
+     * 导出企业账户记录列表
+     */
+    @PreAuthorize("@ss.hasAnyPermi('company:companyMoneyLogs:export,company:companyMoneyLogs:export1,company:companyMoneyLogs:export2')")
+    @Log(title = "企业账户记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyMoneyLogs companyMoneyLogs)
+    {
+        if(companyMoneyLogs.getType()==0){
+            List<CompanyMoneyLogsExportVO> list = companyMoneyLogsService.selectCompanyMoneyLogsExportVOList(companyMoneyLogs);
+            ExcelUtil<CompanyMoneyLogsExportVO> util = new ExcelUtil<CompanyMoneyLogsExportVO>(CompanyMoneyLogsExportVO.class);
+            return util.exportExcel(list, "全部流水");
+        }
+        else if(companyMoneyLogs.getType()==1){
+            List<CompanyMoneyLogsExport1VO> list = companyMoneyLogsService.selectCompanyMoneyLogsExport1VOList(companyMoneyLogs);
+            for (CompanyMoneyLogsExport1VO vo : list){
+                vo.setUserPhone(ParseUtils.parsePhone(vo.getUserPhone()));
+                vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
+            }
+            ExcelUtil<CompanyMoneyLogsExport1VO> util = new ExcelUtil<CompanyMoneyLogsExport1VO>(CompanyMoneyLogsExport1VO.class);
+            return util.exportExcel(list, "商城订单");
+        }
+        else if(companyMoneyLogs.getType()==2){
+            List<CompanyMoneyLogsExport2VO> list = companyMoneyLogsService.selectCompanyMoneyLogsExport2VOList(companyMoneyLogs);
+            ExcelUtil<CompanyMoneyLogsExport2VO> util = new ExcelUtil<CompanyMoneyLogsExport2VO>(CompanyMoneyLogsExport2VO.class);
+            return util.exportExcel(list, "收款订单");
+        }
+        return new AjaxResult(500,"操作失败");
+    }
+
+    /**
+     * 获取企业账户记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyMoneyLogs:query')")
+    @GetMapping(value = "/{logsId}")
+    public AjaxResult getInfo(@PathVariable("logsId") Long logsId) {
+        return AjaxResult.success(companyMoneyLogsService.selectCompanyMoneyLogsById(logsId));
+    }
+
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyOperLogController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyOperLog;
+import com.fs.company.service.ICompanyOperLogService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 操作日志记录Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyOperLog")
+public class CompanyOperLogController extends BaseController
+{
+    @Autowired
+    private ICompanyOperLogService companyOperLogService;
+
+    /**
+     * 查询操作日志记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyOperLog companyOperLog)
+    {
+        startPage();
+        List<CompanyOperLog> list = companyOperLogService.selectCompanyOperLogList(companyOperLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出操作日志记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:export')")
+    @Log(title = "操作日志记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyOperLog companyOperLog)
+    {
+        List<CompanyOperLog> list = companyOperLogService.selectCompanyOperLogList(companyOperLog);
+        ExcelUtil<CompanyOperLog> util = new ExcelUtil<CompanyOperLog>(CompanyOperLog.class);
+        return util.exportExcel(list, "companyOperLog");
+    }
+
+    /**
+     * 获取操作日志记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:query')")
+    @GetMapping(value = "/{operId}")
+    public AjaxResult getInfo(@PathVariable("operId") Long operId)
+    {
+        return AjaxResult.success(companyOperLogService.selectCompanyOperLogById(operId));
+    }
+
+    /**
+     * 新增操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:add')")
+    @Log(title = "操作日志记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyOperLog companyOperLog)
+    {
+        return toAjax(companyOperLogService.insertCompanyOperLog(companyOperLog));
+    }
+
+    /**
+     * 修改操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:edit')")
+    @Log(title = "操作日志记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyOperLog companyOperLog)
+    {
+        return toAjax(companyOperLogService.updateCompanyOperLog(companyOperLog));
+    }
+
+    /**
+     * 删除操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyOperLog:remove')")
+    @Log(title = "操作日志记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{operIds}")
+    public AjaxResult remove(@PathVariable Long[] operIds)
+    {
+        return toAjax(companyOperLogService.deleteCompanyOperLogByIds(operIds));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyPostController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyPost;
+import com.fs.company.service.ICompanyPostService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 岗位信息Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyPost")
+public class CompanyPostController extends BaseController
+{
+    @Autowired
+    private ICompanyPostService companyPostService;
+
+    /**
+     * 查询岗位信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyPost companyPost)
+    {
+        startPage();
+        List<CompanyPost> list = companyPostService.selectCompanyPostList(companyPost);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出岗位信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:export')")
+    @Log(title = "岗位信息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyPost companyPost)
+    {
+        List<CompanyPost> list = companyPostService.selectCompanyPostList(companyPost);
+        ExcelUtil<CompanyPost> util = new ExcelUtil<CompanyPost>(CompanyPost.class);
+        return util.exportExcel(list, "companyPost");
+    }
+
+    /**
+     * 获取岗位信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:query')")
+    @GetMapping(value = "/{postId}")
+    public AjaxResult getInfo(@PathVariable("postId") Long postId)
+    {
+        return AjaxResult.success(companyPostService.selectCompanyPostById(postId));
+    }
+
+    /**
+     * 新增岗位信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:add')")
+    @Log(title = "岗位信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyPost companyPost)
+    {
+        return toAjax(companyPostService.insertCompanyPost(companyPost));
+    }
+
+    /**
+     * 修改岗位信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:edit')")
+    @Log(title = "岗位信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyPost companyPost)
+    {
+        return toAjax(companyPostService.updateCompanyPost(companyPost));
+    }
+
+    /**
+     * 删除岗位信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyPost:remove')")
+    @Log(title = "岗位信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{postIds}")
+    public AjaxResult remove(@PathVariable Long[] postIds)
+    {
+        return toAjax(companyPostService.deleteCompanyPostByIds(postIds));
+    }
+}

+ 285 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyProfitController.java

@@ -0,0 +1,285 @@
+package com.fs.company.controller;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyMoneyLogs;
+import com.fs.company.domain.CompanyProfitLogs;
+import com.fs.company.param.CompanyProfitAuditParam;
+import com.fs.company.service.ICompanyMoneyLogsService;
+import com.fs.company.service.ICompanyProfitLogsService;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.CompanyProfitVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.parameters.P;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyProfit;
+import com.fs.company.service.ICompanyProfitService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 提现Controller
+ *
+ * @author fs
+ * @date 2022-07-04
+ */
+@RestController
+@RequestMapping("/company/companyProfit")
+public class CompanyProfitController extends BaseController
+{
+    @Autowired
+    private ICompanyProfitService companyProfitService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ICompanyMoneyLogsService moneyLogsService;
+    @Autowired
+    private ICompanyProfitLogsService logsService;
+    @Autowired
+    private TokenService tokenService;
+    /**
+     * 查询提现列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyProfit companyProfit)
+    {
+        startPage();
+        List<CompanyProfitVO> list = companyProfitService.selectCompanyProfitListVO(companyProfit);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出提现列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:export')")
+    @Log(title = "提现", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyProfit companyProfit)
+    {
+        List<CompanyProfitVO> list = companyProfitService.selectCompanyProfitListVO(companyProfit);
+        ExcelUtil<CompanyProfitVO> util = new ExcelUtil<CompanyProfitVO>(CompanyProfitVO.class);
+        return util.exportExcel(list, "公司提现记录");
+    }
+
+    /**
+     * 获取提现详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:query')")
+    @GetMapping(value = "/{profitId}")
+    public R getInfo(@PathVariable("profitId") Long profitId)
+    {
+        CompanyProfit profit=companyProfitService.selectCompanyProfitById(profitId);
+        CompanyProfitLogs map=new CompanyProfitLogs();
+        map.setProfitId(profitId);
+        List<CompanyProfitLogs> logs= logsService.selectCompanyProfitLogsList(map);
+        return R.ok().put("profit",profit).put("logs",logs);
+    }
+
+    /**
+     * 新增提现
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:add')")
+    @Log(title = "提现", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyProfit companyProfit)
+    {
+        return toAjax(companyProfitService.insertCompanyProfit(companyProfit));
+    }
+
+    /**
+     * 修改提现
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:edit')")
+    @Log(title = "提现", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyProfit companyProfit)
+    {
+        return toAjax(companyProfitService.updateCompanyProfit(companyProfit));
+    }
+
+    /**
+     * 删除提现
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:remove')")
+    @Log(title = "提现", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{profitIds}")
+    public AjaxResult remove(@PathVariable Long[] profitIds)
+    {
+        return toAjax(companyProfitService.deleteCompanyProfitByIds(profitIds));
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:audit1')")
+    @PostMapping("/audit1")
+    @Transactional
+    public R audit1(@RequestBody CompanyProfitAuditParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyProfit profit=companyProfitService.selectCompanyProfitById(param.getProfitId());
+        if(profit.getProfitStatus()!=1){
+            return R.error("非法操作");
+        }
+        Company company=companyService.selectCompanyByIdForUpdate(profit.getCompanyId());
+        if(param.getStatus()==1){
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(2);
+            profit.setUpdateTime(new Date());
+            companyProfitService.updateCompanyProfit(profit);
+            CompanyProfitLogs logs=new CompanyProfitLogs();
+            logs.setProfitId(profit.getProfitId());
+            logs.setReason(param.getRemark());
+            logs.setCreateTime(new Date());
+            logs.setTitle(loginUser.getUser().getNickName()+"审核通过");
+            logsService.insertCompanyProfitLogs(logs);
+        }
+        else if(param.getStatus()==0){
+            //驳回退款
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(0);
+            profit.setUpdateTime(new Date());
+            companyProfitService.updateCompanyProfit(profit);
+            company.setMoney(company.getMoney().add(profit.getMoney()));
+            companyService.updateCompany(company);
+            CompanyMoneyLogs logs=new CompanyMoneyLogs();
+            logs.setCompanyId(company.getCompanyId());
+            logs.setMoney(profit.getMoney());
+            logs.setLogsType(7);
+            logs.setBalance(company.getMoney());
+            logs.setRemark("驳回退款:"+profit.getMoney());
+            logs.setCreateTime(new Date());
+            moneyLogsService.insertCompanyMoneyLogs(logs);
+
+            CompanyProfitLogs profitLogs=new CompanyProfitLogs();
+            profitLogs.setProfitId(profit.getProfitId());
+            profitLogs.setReason(param.getRemark());
+            profitLogs.setCreateTime(new Date());
+            profitLogs.setTitle(loginUser.getUser().getNickName()+"驳回退款");
+            logsService.insertCompanyProfitLogs(profitLogs);
+        }
+        return R.ok("操作成功");
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:audit2')")
+    @PostMapping("/audit2")
+    @Transactional
+    public R audit2(@RequestBody CompanyProfitAuditParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyProfit profit=companyProfitService.selectCompanyProfitById(param.getProfitId());
+        if(profit.getProfitStatus()!=2){
+            return R.error("非法操作");
+        }
+        Company company=companyService.selectCompanyByIdForUpdate(profit.getCompanyId());
+        if(param.getStatus()==1){
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(3);
+            profit.setUpdateTime(new Date());
+            companyProfitService.updateCompanyProfit(profit);
+            CompanyProfitLogs logs=new CompanyProfitLogs();
+            logs.setProfitId(profit.getProfitId());
+            logs.setReason(param.getRemark());
+            logs.setCreateTime(new Date());
+            logs.setTitle(loginUser.getUser().getNickName()+"审核通过");
+            logsService.insertCompanyProfitLogs(logs);
+        }
+        else if(param.getStatus()==0){
+            //驳回退款
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(0);
+            profit.setUpdateTime(new Date());
+            companyProfitService.updateCompanyProfit(profit);
+            company.setMoney(company.getMoney().add(profit.getMoney()));
+            companyService.updateCompany(company);
+            CompanyMoneyLogs logs=new CompanyMoneyLogs();
+            logs.setCompanyId(company.getCompanyId());
+            logs.setMoney(profit.getMoney());
+            logs.setLogsType(7);
+            logs.setBalance(company.getMoney());
+            logs.setRemark("驳回退款:"+profit.getMoney());
+            logs.setCreateTime(new Date());
+            moneyLogsService.insertCompanyMoneyLogs(logs);
+
+            CompanyProfitLogs profitLogs=new CompanyProfitLogs();
+            profitLogs.setProfitId(profit.getProfitId());
+            profitLogs.setReason(param.getRemark());
+            profitLogs.setCreateTime(new Date());
+            profitLogs.setTitle(loginUser.getUser().getNickName()+"驳回退款");
+            logsService.insertCompanyProfitLogs(profitLogs);
+        }
+        return R.ok("操作成功");
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyProfit:audit3')")
+    @PostMapping("/audit3")
+    @Transactional
+    public R audit3(@RequestBody CompanyProfitAuditParam param)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyProfit profit=companyProfitService.selectCompanyProfitById(param.getProfitId());
+        if(profit.getProfitStatus()!=3){
+            return R.error("非法操作");
+        }
+        Company company=companyService.selectCompanyByIdForUpdate(profit.getCompanyId());
+        if(param.getStatus()==1){
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(4);
+            profit.setUpdateTime(new Date());
+            profit.setImgUrl(param.getImgUrl());
+            companyProfitService.updateCompanyProfit(profit);
+            CompanyProfitLogs logs=new CompanyProfitLogs();
+            logs.setProfitId(profit.getProfitId());
+            logs.setReason(param.getRemark());
+            logs.setCreateTime(new Date());
+            logs.setTitle(loginUser.getUser().getNickName()+"审核通过");
+            logsService.insertCompanyProfitLogs(logs);
+        }
+        else if(param.getStatus()==0){
+            //驳回退款
+            profit.setRemark(param.getRemark());
+            profit.setProfitStatus(0);
+            profit.setUpdateTime(new Date());
+            companyProfitService.updateCompanyProfit(profit);
+            company.setMoney(company.getMoney().add(profit.getMoney()));
+            companyService.updateCompany(company);
+            CompanyMoneyLogs logs=new CompanyMoneyLogs();
+            logs.setCompanyId(company.getCompanyId());
+            logs.setMoney(profit.getMoney());
+            logs.setLogsType(7);
+            logs.setBalance(company.getMoney());
+            logs.setRemark("驳回退款:"+profit.getMoney());
+            logs.setCreateTime(new Date());
+            moneyLogsService.insertCompanyMoneyLogs(logs);
+
+            CompanyProfitLogs profitLogs=new CompanyProfitLogs();
+            profitLogs.setProfitId(profit.getProfitId());
+            profitLogs.setReason(param.getRemark());
+            profitLogs.setCreateTime(new Date());
+            profitLogs.setTitle(loginUser.getUser().getNickName()+"驳回退款");
+            logsService.insertCompanyProfitLogs(profitLogs);
+        }
+        return R.ok("操作成功");
+    }
+
+
+}

+ 150 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyRechargeController.java

@@ -0,0 +1,150 @@
+package com.fs.company.controller;
+
+import java.util.Date;
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyMoneyLogs;
+import com.fs.company.service.ICompanyMoneyLogsService;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.CompanyRechargeExportVO;
+import com.fs.company.vo.CompanyRechargeVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import lombok.Synchronized;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyRecharge;
+import com.fs.company.service.ICompanyRechargeService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 充值Controller
+ *
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyRecharge")
+public class CompanyRechargeController extends BaseController
+{
+    @Autowired
+    private TokenService tokenService;
+    @Autowired
+    private ICompanyRechargeService companyRechargeService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ICompanyMoneyLogsService moneyLogsService;
+    /**
+     * 查询充值列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyRecharge companyRecharge)
+    {
+        startPage();
+        List<CompanyRechargeVO> list = companyRechargeService.selectCompanyRechargeVOList(companyRecharge);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出充值列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:export')")
+    @Log(title = "充值", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyRecharge companyRecharge)
+    {
+        List<CompanyRechargeExportVO> list = companyRechargeService.selectCompanyRechargeExportList(companyRecharge);
+        ExcelUtil<CompanyRechargeExportVO> util = new ExcelUtil<CompanyRechargeExportVO>(CompanyRechargeExportVO.class);
+        return util.exportExcel(list, "公司充值明细");
+    }
+
+    /**
+     * 获取充值详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:query')")
+    @GetMapping(value = "/{rechargeId}")
+    public AjaxResult getInfo(@PathVariable("rechargeId") Long rechargeId)
+    {
+        return AjaxResult.success(companyRechargeService.selectCompanyRechargeById(rechargeId));
+    }
+
+    /**
+     * 新增充值
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:add')")
+    @Log(title = "充值", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyRecharge companyRecharge)
+    {
+        return toAjax(companyRechargeService.insertCompanyRecharge(companyRecharge));
+    }
+
+
+
+    /**
+     * 删除充值
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:remove')")
+    @Log(title = "充值", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{rechargeIds}")
+    public AjaxResult remove(@PathVariable Long[] rechargeIds)
+    {
+        return toAjax(companyRechargeService.deleteCompanyRechargeByIds(rechargeIds));
+    }
+
+
+
+    @PreAuthorize("@ss.hasPermi('company:companyRecharge:audit')")
+    @PostMapping("/audit")
+    @Transactional
+    @Synchronized
+    public R audit(@RequestBody CompanyRecharge param)
+    {
+        CompanyRecharge companyRecharge=companyRechargeService.selectCompanyRechargeById(param.getRechargeId());
+        if(companyRecharge.getIsAudit()!=0){
+            return R.error("非法操作");
+        }
+        companyRecharge.setIsAudit(param.getIsAudit());
+        companyRecharge.setRemark(param.getRemark());
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if(companyRecharge.getIsAudit()==1){
+            Company company=companyService.selectCompanyById(companyRecharge.getCompanyId());
+            company.setMoney(company.getMoney().add(companyRecharge.getMoney()));
+            companyService.updateCompany(company);
+            CompanyMoneyLogs log=new CompanyMoneyLogs();
+            log.setCompanyId(companyRecharge.getCompanyId());
+            log.setMoney(companyRecharge.getMoney());
+            log.setRemark(companyRecharge.getRemark());
+            log.setLogsType(1);
+            log.setBalance(company.getMoney());
+            log.setCreateTime(new Date());
+            moneyLogsService.insertCompanyMoneyLogs(log);
+            companyRecharge.setPayTime(new Date());
+            companyRecharge.setStatus(1);
+        }
+        companyRecharge.setAuditTime(new Date());
+        companyRecharge.setAuditUserId(loginUser.getUser().getUserId());
+        companyRechargeService.updateCompanyRecharge(companyRecharge);
+        return R.ok("操作成功");
+
+    }
+}

+ 128 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyRedPackageLogsController.java

@@ -0,0 +1,128 @@
+package com.fs.company.controller;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyRedPackageLogs;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyRedPackageLogsService;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 公司红包余额日志Controller
+ * 
+ * @author 吴树波
+ * @date 2025-04-15
+ */
+@RestController
+@RequestMapping("/company/CompanyRedPackageLogs")
+public class CompanyRedPackageLogsController extends BaseController
+{
+    @Autowired
+    private ICompanyRedPackageLogsService companyRedPackageLogsService;
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询公司红包余额日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyRedPackageLogs companyRedPackageLogs)
+    {
+        startPage();
+        List<CompanyRedPackageLogs> list = companyRedPackageLogsService.selectCompanyRedPackageLogsList(companyRedPackageLogs);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出公司红包余额日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:export')")
+    @Log(title = "公司红包余额日志", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyRedPackageLogs companyRedPackageLogs)
+    {
+        List<CompanyRedPackageLogs> list = companyRedPackageLogsService.selectCompanyRedPackageLogsList(companyRedPackageLogs);
+        ExcelUtil<CompanyRedPackageLogs> util = new ExcelUtil<CompanyRedPackageLogs>(CompanyRedPackageLogs.class);
+        return util.exportExcel(list, "公司红包余额日志数据");
+    }
+
+    /**
+     * 获取公司红包余额日志详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(companyRedPackageLogsService.selectCompanyRedPackageLogsById(id));
+    }
+
+    /**
+     * 新增公司红包余额日志
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:add')")
+    @Log(title = "公司红包余额日志", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyRedPackageLogs companyRedPackageLogs)
+    {
+        return toAjax(companyRedPackageLogsService.insertCompanyRedPackageLogs(companyRedPackageLogs));
+    }
+
+    /**
+     * 修改公司红包余额日志
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:edit')")
+    @Log(title = "公司红包余额日志", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyRedPackageLogs companyRedPackageLogs)
+    {
+        return toAjax(companyRedPackageLogsService.updateCompanyRedPackageLogs(companyRedPackageLogs));
+    }
+
+    /**
+     * 删除公司红包余额日志
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:remove')")
+    @Log(title = "公司红包余额日志", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(companyRedPackageLogsService.deleteCompanyRedPackageLogsByIds(ids));
+    }
+
+    /**
+     * 删除公司红包余额日志
+     */
+    @PreAuthorize("@ss.hasPermi('company:CompanyRedPackageLogs:add')")
+    @Log(title = "充值余额", businessType = BusinessType.INSERT)
+	@PostMapping("/recharge")
+    public R recharge(@RequestBody CompanyRedPackageLogs companyRedPackageLogs){
+        companyRedPackageLogsService.recharge(companyRedPackageLogs);
+        return R.ok();
+    }
+
+
+
+    @GetMapping(value = "/getMoneyPri")
+    public R getMoneyPri(){
+        return R.ok().put("data", companyRedPackageLogsService.getMoneyPri());
+    }
+    // 充值审核
+    @PostMapping(value = "/rew")
+    public R rew(@RequestBody CompanyRedPackageLogs companyRedPackageLogs){
+        companyRedPackageLogsService.rew(companyRedPackageLogs);
+        return R.ok();
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyRoleController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyRole;
+import com.fs.company.service.ICompanyRoleService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 角色信息Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyRole")
+public class CompanyRoleController extends BaseController
+{
+    @Autowired
+    private ICompanyRoleService companyRoleService;
+
+    /**
+     * 查询角色信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyRole companyRole)
+    {
+        startPage();
+        List<CompanyRole> list = companyRoleService.selectCompanyRoleList(companyRole);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出角色信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:export')")
+    @Log(title = "角色信息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyRole companyRole)
+    {
+        List<CompanyRole> list = companyRoleService.selectCompanyRoleList(companyRole);
+        ExcelUtil<CompanyRole> util = new ExcelUtil<CompanyRole>(CompanyRole.class);
+        return util.exportExcel(list, "companyRole");
+    }
+
+    /**
+     * 获取角色信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:query')")
+    @GetMapping(value = "/{roleId}")
+    public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
+    {
+        return AjaxResult.success(companyRoleService.selectCompanyRoleById(roleId));
+    }
+
+    /**
+     * 新增角色信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:add')")
+    @Log(title = "角色信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyRole companyRole)
+    {
+        return toAjax(companyRoleService.insertCompanyRole(companyRole));
+    }
+
+    /**
+     * 修改角色信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:edit')")
+    @Log(title = "角色信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyRole companyRole)
+    {
+        return toAjax(companyRoleService.updateCompanyRole(companyRole));
+    }
+
+    /**
+     * 删除角色信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRole:remove')")
+    @Log(title = "角色信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{roleIds}")
+    public AjaxResult remove(@PathVariable Long[] roleIds)
+    {
+        return toAjax(companyRoleService.deleteCompanyRoleByIds(roleIds));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyRoleDeptController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyRoleDept;
+import com.fs.company.service.ICompanyRoleDeptService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 角色和部门关联Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyRoleDept")
+public class CompanyRoleDeptController extends BaseController
+{
+    @Autowired
+    private ICompanyRoleDeptService companyRoleDeptService;
+
+    /**
+     * 查询角色和部门关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyRoleDept companyRoleDept)
+    {
+        startPage();
+        List<CompanyRoleDept> list = companyRoleDeptService.selectCompanyRoleDeptList(companyRoleDept);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出角色和部门关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:export')")
+    @Log(title = "角色和部门关联", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyRoleDept companyRoleDept)
+    {
+        List<CompanyRoleDept> list = companyRoleDeptService.selectCompanyRoleDeptList(companyRoleDept);
+        ExcelUtil<CompanyRoleDept> util = new ExcelUtil<CompanyRoleDept>(CompanyRoleDept.class);
+        return util.exportExcel(list, "companyRoleDept");
+    }
+
+    /**
+     * 获取角色和部门关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:query')")
+    @GetMapping(value = "/{roleId}")
+    public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
+    {
+        return AjaxResult.success(companyRoleDeptService.selectCompanyRoleDeptById(roleId));
+    }
+
+    /**
+     * 新增角色和部门关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:add')")
+    @Log(title = "角色和部门关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyRoleDept companyRoleDept)
+    {
+        return toAjax(companyRoleDeptService.insertCompanyRoleDept(companyRoleDept));
+    }
+
+    /**
+     * 修改角色和部门关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:edit')")
+    @Log(title = "角色和部门关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyRoleDept companyRoleDept)
+    {
+        return toAjax(companyRoleDeptService.updateCompanyRoleDept(companyRoleDept));
+    }
+
+    /**
+     * 删除角色和部门关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleDept:remove')")
+    @Log(title = "角色和部门关联", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{roleIds}")
+    public AjaxResult remove(@PathVariable Long[] roleIds)
+    {
+        return toAjax(companyRoleDeptService.deleteCompanyRoleDeptByIds(roleIds));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyRoleMenuController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyRoleMenu;
+import com.fs.company.service.ICompanyRoleMenuService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 角色和菜单关联Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyRoleMenu")
+public class CompanyRoleMenuController extends BaseController
+{
+    @Autowired
+    private ICompanyRoleMenuService companyRoleMenuService;
+
+    /**
+     * 查询角色和菜单关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyRoleMenu companyRoleMenu)
+    {
+        startPage();
+        List<CompanyRoleMenu> list = companyRoleMenuService.selectCompanyRoleMenuList(companyRoleMenu);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出角色和菜单关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:export')")
+    @Log(title = "角色和菜单关联", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyRoleMenu companyRoleMenu)
+    {
+        List<CompanyRoleMenu> list = companyRoleMenuService.selectCompanyRoleMenuList(companyRoleMenu);
+        ExcelUtil<CompanyRoleMenu> util = new ExcelUtil<CompanyRoleMenu>(CompanyRoleMenu.class);
+        return util.exportExcel(list, "companyRoleMenu");
+    }
+
+    /**
+     * 获取角色和菜单关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:query')")
+    @GetMapping(value = "/{roleId}")
+    public AjaxResult getInfo(@PathVariable("roleId") Long roleId)
+    {
+        return AjaxResult.success(companyRoleMenuService.selectCompanyRoleMenuById(roleId));
+    }
+
+    /**
+     * 新增角色和菜单关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:add')")
+    @Log(title = "角色和菜单关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyRoleMenu companyRoleMenu)
+    {
+        return toAjax(companyRoleMenuService.insertCompanyRoleMenu(companyRoleMenu));
+    }
+
+    /**
+     * 修改角色和菜单关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:edit')")
+    @Log(title = "角色和菜单关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyRoleMenu companyRoleMenu)
+    {
+        return toAjax(companyRoleMenuService.updateCompanyRoleMenu(companyRoleMenu));
+    }
+
+    /**
+     * 删除角色和菜单关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyRoleMenu:remove')")
+    @Log(title = "角色和菜单关联", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{roleIds}")
+    public AjaxResult remove(@PathVariable Long[] roleIds)
+    {
+        return toAjax(companyRoleMenuService.deleteCompanyRoleMenuByIds(roleIds));
+    }
+}

+ 134 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanySmsController.java

@@ -0,0 +1,134 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.alibaba.fastjson.JSON;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.company.domain.CompanySmsOrder;
+import com.fs.company.dto.CompBuySmsDTO;
+import com.fs.company.vo.CompanySmsListVO;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.http.util.Asserts;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanySms;
+import com.fs.company.service.ICompanySmsService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 公司短信Controller
+ * 
+ * @author fs
+ * @date 2023-01-09
+ */
+@RestController
+@RequestMapping("/company/companySms")
+public class CompanySmsController extends BaseController
+{
+    @Autowired
+    private ICompanySmsService companySmsService;
+
+    /**
+     * 查询公司短信列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:list')")
+    @PostMapping("/buySms")
+    @RepeatSubmit
+    public AjaxResult buySms(CompBuySmsDTO compBuySmsDTO){
+        logger.info("开始执行购买短信接口,请求参数:{}", compBuySmsDTO);
+
+        Asserts.notNull(compBuySmsDTO,"充值短信参数不能为空");
+        Asserts.notNull(compBuySmsDTO.getCompanyId(),"公司id不能为空!");
+        Asserts.notNull(compBuySmsDTO.getPackageId(),"短信套餐id不能为空!");
+
+        CompanySmsOrder companySmsOrder=null;
+        try{
+            companySmsOrder = companySmsService.buySms(compBuySmsDTO);
+        }catch (Exception e){
+            logger.error("购买短信接口异常,异常信息:{}", ExceptionUtils.getFullStackTrace(e));
+            throw e;
+        }
+        return AjaxResult.success(companySmsOrder);
+    }
+
+    /**
+     * 查询公司短信列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySms companySms)
+    {
+        startPage();
+        List<CompanySmsListVO> list = companySmsService.selectCompanySmsList(companySms);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出公司短信列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:export')")
+    @Log(title = "公司短信", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySms companySms)
+    {
+        List<CompanySmsListVO> list = companySmsService.selectCompanySmsList(companySms);
+        ExcelUtil<CompanySmsListVO> util = new ExcelUtil<CompanySmsListVO>(CompanySmsListVO.class);
+        return util.exportExcel(list, "companySms");
+    }
+
+    /**
+     * 获取公司短信详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:query')")
+    @GetMapping(value = "/{smsId}")
+    public AjaxResult getInfo(@PathVariable("smsId") Long smsId)
+    {
+        return AjaxResult.success(companySmsService.selectCompanySmsById(smsId));
+    }
+
+    /**
+     * 新增公司短信
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:add')")
+    @Log(title = "公司短信", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanySms companySms)
+    {
+        return toAjax(companySmsService.insertCompanySms(companySms));
+    }
+
+    /**
+     * 修改公司短信
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:edit')")
+    @Log(title = "公司短信", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanySms companySms)
+    {
+        return toAjax(companySmsService.updateCompanySms(companySms));
+    }
+
+    /**
+     * 删除公司短信
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySms:remove')")
+    @Log(title = "公司短信", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{smsIds}")
+    public AjaxResult remove(@PathVariable Long[] smsIds)
+    {
+        return toAjax(companySmsService.deleteCompanySmsByIds(smsIds));
+    }
+}

+ 124 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanySmsLogsController.java

@@ -0,0 +1,124 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.company.param.CompanySmsLogsListParam;
+import com.fs.company.vo.CompanySmsLogsListVO;
+import com.fs.store.vo.FsStoreOrderVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanySmsLogs;
+import com.fs.company.service.ICompanySmsLogsService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 短信发送记录Controller
+ * 
+ * @author fs
+ * @date 2023-01-09
+ */
+@RestController
+@RequestMapping("/company/companySmsLogs")
+public class CompanySmsLogsController extends BaseController
+{
+    @Autowired
+    private ICompanySmsLogsService companySmsLogsService;
+
+    /**
+     * 查询短信发送记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySmsLogsListParam companySmsLogs)
+    {
+        startPage();
+
+        List<CompanySmsLogsListVO> list = companySmsLogsService.selectCompanySmsLogsList(companySmsLogs);
+        if (list != null) {
+            for (CompanySmsLogsListVO vo : list) {
+                if(vo.getPhone()!=null){
+                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+
+            }
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信发送记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:export')")
+    @Log(title = "短信发送记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySmsLogsListParam companySmsLogs)
+    {
+        List<CompanySmsLogsListVO> list = companySmsLogsService.selectCompanySmsLogsList(companySmsLogs);
+        if (list != null) {
+            for (CompanySmsLogsListVO vo : list) {
+                if(vo.getPhone()!=null){
+                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+
+            }
+        }
+        ExcelUtil<CompanySmsLogsListVO> util = new ExcelUtil<CompanySmsLogsListVO>(CompanySmsLogsListVO.class);
+        return util.exportExcel(list, "companySmsLogs");
+    }
+
+    /**
+     * 获取短信发送记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:query')")
+    @GetMapping(value = "/{logsId}")
+    public AjaxResult getInfo(@PathVariable("logsId") Long logsId)
+    {
+        return AjaxResult.success(companySmsLogsService.selectCompanySmsLogsById(logsId));
+    }
+
+    /**
+     * 新增短信发送记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:add')")
+    @Log(title = "短信发送记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanySmsLogs companySmsLogs)
+    {
+        return toAjax(companySmsLogsService.insertCompanySmsLogs(companySmsLogs));
+    }
+
+    /**
+     * 修改短信发送记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:edit')")
+    @Log(title = "短信发送记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanySmsLogs companySmsLogs)
+    {
+        return toAjax(companySmsLogsService.updateCompanySmsLogs(companySmsLogs));
+    }
+
+    /**
+     * 删除短信发送记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:remove')")
+    @Log(title = "短信发送记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{logsIds}")
+    public AjaxResult remove(@PathVariable Long[] logsIds)
+    {
+        return toAjax(companySmsLogsService.deleteCompanySmsLogsByIds(logsIds));
+    }
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanySmsOrderController.java

@@ -0,0 +1,106 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.company.param.CompanySmsOrderListParam;
+import com.fs.company.vo.CompanySmsOrderListVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanySmsOrder;
+import com.fs.company.service.ICompanySmsOrderService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 短信购买订单Controller
+ * 
+ * @author fs
+ * @date 2023-01-09
+ */
+@RestController
+@RequestMapping("/company/companySmsOrder")
+public class CompanySmsOrderController extends BaseController
+{
+    @Autowired
+    private ICompanySmsOrderService companySmsOrderService;
+
+    /**
+     * 查询短信购买订单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySmsOrderListParam param)
+    {
+        startPage();
+        List<CompanySmsOrderListVO> list = companySmsOrderService.selectCompanySmsOrderList(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信购买订单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:export')")
+    @Log(title = "短信购买订单", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySmsOrderListParam param)
+    {
+        List<CompanySmsOrderListVO> list = companySmsOrderService.selectCompanySmsOrderList(param);
+        ExcelUtil<CompanySmsOrderListVO> util = new ExcelUtil<CompanySmsOrderListVO>(CompanySmsOrderListVO.class);
+        return util.exportExcel(list, "companySmsOrder");
+    }
+
+    /**
+     * 获取短信购买订单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:query')")
+    @GetMapping(value = "/{orderId}")
+    public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
+    {
+        return AjaxResult.success(companySmsOrderService.selectCompanySmsOrderById(orderId));
+    }
+
+    /**
+     * 新增短信购买订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:add')")
+    @Log(title = "短信购买订单", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanySmsOrder companySmsOrder)
+    {
+        return toAjax(companySmsOrderService.insertCompanySmsOrder(companySmsOrder));
+    }
+
+    /**
+     * 修改短信购买订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:edit')")
+    @Log(title = "短信购买订单", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanySmsOrder companySmsOrder)
+    {
+        return toAjax(companySmsOrderService.updateCompanySmsOrder(companySmsOrder));
+    }
+
+    /**
+     * 删除短信购买订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsOrder:remove')")
+    @Log(title = "短信购买订单", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{orderIds}")
+    public AjaxResult remove(@PathVariable Long[] orderIds)
+    {
+        return toAjax(companySmsOrderService.deleteCompanySmsOrderByIds(orderIds));
+    }
+}

+ 114 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanySmsPackageController.java

@@ -0,0 +1,114 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanySmsPackage;
+import com.fs.company.service.ICompanySmsPackageService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 短信套餐包Controller
+ *
+ * @author fs
+ * @date 2023-01-09
+ */
+@RestController
+@RequestMapping("/company/companySmsPackage")
+public class CompanySmsPackageController extends BaseController
+{
+    @Autowired
+    private ICompanySmsPackageService companySmsPackageService;
+
+    /**
+     * 查询短信套餐包列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:list')")
+    @GetMapping("/listAll")
+    public AjaxResult listAll(CompanySmsPackage companySmsPackage)
+    {
+        List<CompanySmsPackage> list = companySmsPackageService.selectCompanySmsPackageList(companySmsPackage);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 查询短信套餐包列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySmsPackage companySmsPackage)
+    {
+        startPage();
+        List<CompanySmsPackage> list = companySmsPackageService.selectCompanySmsPackageList(companySmsPackage);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信套餐包列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:export')")
+    @Log(title = "短信套餐包", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySmsPackage companySmsPackage)
+    {
+        List<CompanySmsPackage> list = companySmsPackageService.selectCompanySmsPackageList(companySmsPackage);
+        ExcelUtil<CompanySmsPackage> util = new ExcelUtil<CompanySmsPackage>(CompanySmsPackage.class);
+        return util.exportExcel(list, "companySmsPackage");
+    }
+
+    /**
+     * 获取短信套餐包详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:query')")
+    @GetMapping(value = "/{packageId}")
+    public AjaxResult getInfo(@PathVariable("packageId") Long packageId)
+    {
+        return AjaxResult.success(companySmsPackageService.selectCompanySmsPackageById(packageId));
+    }
+
+    /**
+     * 新增短信套餐包
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:add')")
+    @Log(title = "短信套餐包", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanySmsPackage companySmsPackage)
+    {
+        return toAjax(companySmsPackageService.insertCompanySmsPackage(companySmsPackage));
+    }
+
+    /**
+     * 修改短信套餐包
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:edit')")
+    @Log(title = "短信套餐包", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanySmsPackage companySmsPackage)
+    {
+        return toAjax(companySmsPackageService.updateCompanySmsPackage(companySmsPackage));
+    }
+
+    /**
+     * 删除短信套餐包
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsPackage:remove')")
+    @Log(title = "短信套餐包", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{packageIds}")
+    public AjaxResult remove(@PathVariable Long[] packageIds)
+    {
+        return toAjax(companySmsPackageService.deleteCompanySmsPackageByIds(packageIds));
+    }
+}

+ 122 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanySmsTempController.java

@@ -0,0 +1,122 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.company.vo.CompanySmsTempListVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanySmsTemp;
+import com.fs.company.service.ICompanySmsTempService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 短信模板Controller
+ * 
+ * @author fs
+ * @date 2023-01-09
+ */
+@RestController
+@RequestMapping("/company/companySmsTemp")
+public class CompanySmsTempController extends BaseController
+{
+    @Autowired
+    private ICompanySmsTempService companySmsTempService;
+
+    /**
+     * 查询短信模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySmsTemp companySmsTemp)
+    {
+        startPage();
+        List<CompanySmsTempListVO> list = companySmsTempService.selectCompanySmsTempListVO(companySmsTemp);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:export')")
+    @Log(title = "短信模板", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySmsTemp companySmsTemp)
+    {
+        List<CompanySmsTemp> list = companySmsTempService.selectCompanySmsTempList(companySmsTemp);
+        ExcelUtil<CompanySmsTemp> util = new ExcelUtil<CompanySmsTemp>(CompanySmsTemp.class);
+        return util.exportExcel(list, "companySmsTemp");
+    }
+
+    /**
+     * 获取短信模板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:query')")
+    @GetMapping(value = "/{tempId}")
+    public AjaxResult getInfo(@PathVariable("tempId") Long tempId)
+    {
+        return AjaxResult.success(companySmsTempService.selectCompanySmsTempById(tempId));
+    }
+
+    /**
+     * 新增短信模板
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:add')")
+    @Log(title = "短信模板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanySmsTemp companySmsTemp)
+    {
+        return toAjax(companySmsTempService.insertCompanySmsTemp(companySmsTemp));
+    }
+
+    /**
+     * 修改短信模板
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:edit')")
+    @Log(title = "短信模板", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanySmsTemp companySmsTemp)
+    {
+        return toAjax(companySmsTempService.updateCompanySmsTemp(companySmsTemp));
+    }
+
+    /**
+     * 删除短信模板
+     */
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:remove')")
+    @Log(title = "短信模板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{tempIds}")
+    public AjaxResult remove(@PathVariable Long[] tempIds)
+    {
+        return toAjax(companySmsTempService.deleteCompanySmsTempByIds(tempIds));
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('company:companySmsTemp:audit')")
+    @PostMapping("/audit")
+    public R audit(@RequestBody CompanySmsTemp companySmsTemp)
+    {
+        CompanySmsTemp map=new CompanySmsTemp();
+        map.setIsAudit(1);
+        map.setTempId(companySmsTemp.getTempId());
+        if(companySmsTempService.updateCompanySmsTemp(map)>0){
+            return R.ok("操作成功");
+        }
+        else{
+            return R.error("操作失败");
+        }
+    }
+}

+ 246 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyStatisticsController.java

@@ -0,0 +1,246 @@
+package com.fs.company.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.TimeUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.param.CompanyStatisticsParam;
+import com.fs.company.service.ICompanySmsLogsService;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.company.service.ICompanyVoiceLogsService;
+import com.fs.company.vo.CompanyPackageOrderStatisticsVO;
+import com.fs.company.vo.CompanySmsLogsStatisticsVO;
+import com.fs.company.vo.CompanyTuiMoneyStatisticsVO;
+import com.fs.company.vo.CompanyVoiceLogsStatisticsVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import com.fs.store.domain.FsStoreOrder;
+import com.fs.store.mapper.FsStoreOrderMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 统计
+ *
+ * @author fs
+ * @date 2021-03-22
+ */
+@RestController
+@RequestMapping("/company/statistics")
+public class CompanyStatisticsController extends BaseController
+{
+
+    @Autowired
+    private ICompanyUserService userService;
+//    @Autowired
+//    private ICompanyPackageOrderService packageOrderService;
+    @Autowired
+    private ICompanyVoiceLogsService voiceLogsService;
+    @Autowired
+    private FsStoreOrderMapper fsStoreOrderMapper;
+    @Autowired
+    private ICompanySmsLogsService smsLogsService;
+    @Autowired
+    private TokenService tokenService;
+    @PreAuthorize("@ss.hasPermi('company:statistics:voiceLogs')")
+    @GetMapping("/voiceLogs")
+    public R voiceLogs(CompanyStatisticsParam param)
+    {
+        if(StringUtils.isNotEmpty(param.getUserIds())){
+            String[] userIds=param.getUserIds().split(",");
+            Long[] ids=new Long[userIds.length];
+            for(int i=0;i<ids.length; i++){
+                ids[i]=Long.parseLong(userIds[i]);
+            }
+            param.setUsers(ids);
+        }
+        else{
+            //获取部门下的所有用户
+            CompanyUser usermap=new CompanyUser();
+            usermap.setDeptId(param.getDeptId());
+            List<CompanyUser> users = userService.getUserListByDeptId(usermap);
+            List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
+            param.setUsers(userIds.toArray(new Long[userIds.size()]));
+        }
+        if(param.getUsers()!=null&&param.getUsers().length>0){
+            List<CompanyVoiceLogsStatisticsVO> list= voiceLogsService.selectVoiceLogsStatisticsList(param);
+            if(list!=null){
+                for(CompanyVoiceLogsStatisticsVO vo:list){
+                    double f1 = new BigDecimal((float)vo.getCallSuccessCount()/vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*100;
+                    vo.setCallRate(f1);
+                }
+            }
+            TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            timeEntity.setUserIds(param.getUsers());
+            Integer cycleNum = timeEntity.getCycleNum();
+            Integer beginTime = timeEntity.getBeginTime();
+            List<Integer> timeList = new ArrayList<>();
+            for (int i = 1; i <= cycleNum; i++) {
+                timeList.add(beginTime);
+                beginTime = TimeUtils.formatTime(beginTime);
+            }
+            List<JSONObject> jsonObjectList = voiceLogsService.selectVoiceLogsTotalCount(timeEntity.toMap());
+            List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
+            List<Integer> callCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("callCount")).collect(Collectors.toList());
+            List<Integer> callSuccessCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("callSuccessCount")).collect(Collectors.toList());
+            List<Integer> times = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("times")).collect(Collectors.toList());
+            List<Integer> billingTime = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("billingTime")).collect(Collectors.toList());
+            return R.ok().put("list",list).put("dates",dates).put("callCount",callCount).put("callSuccessCount",callSuccessCount).put("times",times).put("billingTime",billingTime);
+        }
+        else {
+            return R.ok("未查找到数据");
+        }
+    }
+    @PreAuthorize("@ss.hasPermi('company:statistics:exportVoiceLogs')")
+    @GetMapping("/exportVoiceLogs")
+    public AjaxResult exportVoiceLogs(CompanyStatisticsParam param)
+    {
+        if(StringUtils.isNotEmpty(param.getUserIds())){
+            String[] userIds=param.getUserIds().split(",");
+            Long[] ids=new Long[userIds.length];
+            for(int i=0;i<ids.length; i++){
+                ids[i]=Long.parseLong(userIds[i]);
+            }
+            param.setUsers(ids);
+        }
+        else{
+            //获取所有员工
+            List<CompanyUser> users = userService.selectCompanyUserList(new CompanyUser());
+            List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
+            param.setUsers(userIds.toArray(new Long[userIds.size()]));
+        }
+
+        List<CompanyVoiceLogsStatisticsVO> list= voiceLogsService.selectVoiceLogsStatisticsList(param);
+        if(list!=null){
+            for(CompanyVoiceLogsStatisticsVO vo:list){
+                double f1 = new BigDecimal((float)vo.getCallSuccessCount()/vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*100;
+                vo.setCallRate(f1);
+            }
+        }
+        ExcelUtil<CompanyVoiceLogsStatisticsVO> util = new ExcelUtil<CompanyVoiceLogsStatisticsVO>(CompanyVoiceLogsStatisticsVO.class);
+        return util.exportExcel(list, "voiceLogs");
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('company:statistics:smsLogs')")
+    @GetMapping("/smsLogs")
+    public R smsLogs(CompanyStatisticsParam param)
+    {
+        if(StringUtils.isNotEmpty(param.getUserIds())){
+            String[] userIds=param.getUserIds().split(",");
+            Long[] ids=new Long[userIds.length];
+            for(int i=0;i<ids.length; i++){
+                ids[i]=Long.parseLong(userIds[i]);
+            }
+            param.setUsers(ids);
+        }
+        else{
+            //获取部门下的所有用户
+            CompanyUser usermap=new CompanyUser();
+            usermap.setDeptId(param.getDeptId());
+            List<CompanyUser> users = userService.getUserListByDeptId(usermap);
+            List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
+            param.setUsers(userIds.toArray(new Long[userIds.size()]));
+        }
+        if(param.getUsers()!=null&&param.getUsers().length>0){
+            List<CompanySmsLogsStatisticsVO> list= smsLogsService.selectSmsLogsStatisticsList(param);
+            TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            timeEntity.setUserIds(param.getUsers());
+            Integer cycleNum = timeEntity.getCycleNum();
+            Integer beginTime = timeEntity.getBeginTime();
+            List<Integer> timeList = new ArrayList<>();
+            for (int i = 1; i <= cycleNum; i++) {
+                timeList.add(beginTime);
+                beginTime = TimeUtils.formatTime(beginTime);
+            }
+            List<JSONObject> jsonObjectList = smsLogsService.selectSmsLogsCounts(timeEntity.toMap());
+            List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
+            List<Integer> smsCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("smsCount")).collect(Collectors.toList());
+            List<Integer> successCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("successCount")).collect(Collectors.toList());
+            return R.ok().put("list",list).put("dates",dates).put("smsCount",smsCount).put("successCount",successCount);
+        }
+        else {
+            return R.ok("未查找到数据");
+        }
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:statistics:exportTuiMoney')")
+    @GetMapping("/exportTuiMoney")
+    public AjaxResult exportTuiMoney(CompanyStatisticsParam param)
+    {
+        if(StringUtils.isNotEmpty(param.getUserIds())){
+            String[] userIds=param.getUserIds().split(",");
+            Long[] ids=new Long[userIds.length];
+            for(int i=0;i<ids.length; i++){
+                ids[i]=Long.parseLong(userIds[i]);
+            }
+            param.setUsers(ids);
+        }
+        else{
+            //获取所有员工
+            List<CompanyUser> users = userService.selectCompanyUserList(new CompanyUser());
+            List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
+            param.setUsers(userIds.toArray(new Long[userIds.size()]));
+        }
+
+        List<CompanyTuiMoneyStatisticsVO> list= fsStoreOrderMapper.selectSoreTuiMoneyStatisticsList(param);
+        ExcelUtil<CompanyTuiMoneyStatisticsVO> util = new ExcelUtil<CompanyTuiMoneyStatisticsVO>(CompanyTuiMoneyStatisticsVO.class);
+        return util.exportExcel(list, "voiceLogs");
+    }
+
+
+    @PreAuthorize("@ss.hasPermi('company:statistics:tuiMoney')")
+    @GetMapping("/tuiMoney")
+    public R tuiMoney(CompanyStatisticsParam param)
+    {
+        if(StringUtils.isNotEmpty(param.getUserIds())){
+            String[] userIds=param.getUserIds().split(",");
+            Long[] ids=new Long[userIds.length];
+            for(int i=0;i<ids.length; i++){
+                ids[i]=Long.parseLong(userIds[i]);
+            }
+            param.setUsers(ids);
+        }
+        else{
+            //获取部门下的所有用户
+            CompanyUser usermap=new CompanyUser();
+            usermap.setDeptId(param.getDeptId());
+            List<CompanyUser> users = userService.getUserListByDeptId(usermap);
+            List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
+            param.setUsers(userIds.toArray(new Long[userIds.size()]));
+        }
+        if(param.getUsers()!=null&&param.getUsers().length>0){
+            List<CompanyTuiMoneyStatisticsVO> list= fsStoreOrderMapper.selectSoreTuiMoneyStatisticsList(param);
+            TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            timeEntity.setUserIds(param.getUsers());
+            Integer cycleNum = timeEntity.getCycleNum();
+            Integer beginTime = timeEntity.getBeginTime();
+            List<Integer> timeList = new ArrayList<>();
+            for (int i = 1; i <= cycleNum; i++) {
+                timeList.add(beginTime);
+                beginTime = TimeUtils.formatTime(beginTime);
+            }
+            List<JSONObject> jsonObjectList = fsStoreOrderMapper.selectTuiMoneyCounts(timeEntity.toMap());
+            List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
+            List<Integer> tuiMoneyCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("tuiMoneyCount")).collect(Collectors.toList());
+            List<Integer> tuiMoney = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("tuiMoney")).collect(Collectors.toList());
+            return R.ok().put("list",list).put("dates",dates).put("tuiMoneyCount",tuiMoneyCount).put("tuiMoney",tuiMoney);
+        }
+        else {
+            return R.ok("未查找到数据");
+        }
+    }
+}

+ 261 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyTcmReportController.java

@@ -0,0 +1,261 @@
+package com.fs.company.controller;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.company.vo.CompanyTcmReportExportVO;
+import com.fs.company.domain.CompanyTcmSchedule;
+import com.fs.company.param.CompanyTcmReportListQueryParam;
+import com.fs.company.service.ICompanyTcmScheduleService;
+import com.fs.company.vo.CompanyTcmReportListVO;
+import com.fs.company.vo.CompanyTcmStatisticsExportVO;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.service.ICompanyTcmReportService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 中医档期业绩报表Controller
+ *
+ * @author fs
+ * @date 2023-09-05
+ */
+@RestController
+@RequestMapping("/company/scheduleReport")
+public class CompanyTcmReportController extends BaseController
+{
+    @Autowired
+    private ICompanyTcmReportService companyTcmReportService;
+
+    @Autowired
+    private ICompanyTcmScheduleService companyTcmScheduleService;
+
+    @Autowired
+    private TokenService tokenService;
+
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyTcmReportListQueryParam param)
+    {
+        startPage();
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyTcmReportListVO> list = companyTcmReportService.selectCompanyTcmReportListVOList(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:statistics')")
+    @GetMapping("/statistics")
+    public TableDataInfo statisticsList(CompanyTcmReportListQueryParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyTcmReportListVO> list = companyTcmReportService.selectCompanyTcmReportStatisticsVOList(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:statistics')")
+    @GetMapping("/getStatisticsByScheduleId")
+    public TableDataInfo getReportStatisticsListByScheduleId(CompanyTcmReportListQueryParam param)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyTcmReportListVO> list = companyTcmReportService.selectReportStatisticsByScheduleId(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:export')")
+    @Log(title = "中医档期业绩报表", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyTcmReportListQueryParam param)
+    {
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyTcmReportExportVO> list = companyTcmReportService.selectCompanyTcmReportExportVOList(param);
+        ExcelUtil<CompanyTcmReportExportVO> util = new ExcelUtil<CompanyTcmReportExportVO>(CompanyTcmReportExportVO.class);
+        return util.exportExcel(list, "companyTcmScheduleReport");
+    }
+
+    /**
+     * 导出中医档期业绩报表列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:export')")
+    @Log(title = "中医档期业绩统计报表", businessType = BusinessType.EXPORT)
+    @GetMapping("/exportStatistics")
+    public AjaxResult exportStatistics(CompanyTcmReportListQueryParam param)
+    {
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyTcmStatisticsExportVO> list = companyTcmReportService.selectCompanyTcmStatisticsExportVOList(param);
+        for(CompanyTcmStatisticsExportVO item:list){
+            if(item.getTotalNum()!=null && item.getTotalNum().doubleValue()>0){
+                item.setRegisterRate(String.format("%.3f",getLongRate(item.getRegisterNum().doubleValue(),item.getTotalNum())*100.0).toString()+"%");
+                item.setOnlineRate(String.format("%.3f",getLongRate(item.getOnlineNum().doubleValue(),item.getTotalNum())*100.0).toString()+"%");
+                item.setFinishRate(String.format("%.3f", getLongRate(item.getFinishNum().doubleValue(),item.getTotalNum())*100.0).toString()+"%");
+                item.setRLine(new BigDecimal(getLongRate(item.getTotalMoney().doubleValue(),item.getTotalNum())*1.0).setScale(3, RoundingMode.HALF_UP));
+
+            }else{
+                item.setRegisterRate("0%");
+                item.setOnlineRate("0%");
+                item.setFinishRate("0%");
+                item.setRLine(new BigDecimal(0.0));
+            }
+
+            if(item.getCuCount()!=null && item.getCuCount().doubleValue()>0){
+                item.setPersonMoney(String.format("%.3f",getLongRate(item.getTotalMoney().doubleValue(),Long.valueOf(item.getCuCount()))*1.0).toString());
+            }else{
+                item.setCuCount(0);
+            }
+
+            if(item.getTargetMoney()!=null && item.getTargetMoney().doubleValue()>0){
+                item.setTargetRate(String.format("%.3f", item.getTotalMoney().doubleValue()/item.getTargetMoney().doubleValue()*100.0).toString()+"%");
+            }else{
+                item.setTargetRate("0%");
+            }
+            if(item.getMoney()!=null && item.getMoney().doubleValue()>0){
+                item.setZroi(new BigDecimal(item.getTotalMoney().doubleValue()/item.getMoney().doubleValue()*1.0).setScale(3, RoundingMode.HALF_UP));
+            }else{
+                item.setZroi(new BigDecimal(0.0));
+            }
+            if(item.getRound1Order()!=null){
+                item.setRound1Rate(getRoundRate(item.getRound1Order(),item.getTotalNum()));
+                item.setRound1Unit(new BigDecimal(getRoundUnit(item.getRound1Money(),item.getRound1Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound2Order()!=null){
+                item.setRound2Rate(getRoundRate(item.getRound2Order(),item.getTotalNum()));
+                item.setRound2Unit(new BigDecimal(getRoundUnit(item.getRound2Money(),item.getRound2Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound3Order()!=null){
+                item.setRound3Rate(getRoundRate(item.getRound3Order(),item.getTotalNum()));
+                item.setRound3Unit(new BigDecimal(getRoundUnit(item.getRound3Money(),item.getRound3Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound4Order()!=null){
+                item.setRound4Rate(getRoundRate(item.getRound4Order(),item.getTotalNum()));
+                item.setRound4Unit(new BigDecimal(getRoundUnit(item.getRound4Money(),item.getRound4Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound5Order()!=null){
+                item.setRound5Rate(getRoundRate(item.getRound5Order(),item.getTotalNum()));
+                item.setRound5Unit(new BigDecimal(getRoundUnit(item.getRound5Money(),item.getRound5Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound6Order()!=null){
+                item.setRound6Rate(getRoundRate(item.getRound6Order(),item.getTotalNum()));
+                item.setRound6Unit(new BigDecimal(getRoundUnit(item.getRound6Money(),item.getRound6Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if(item.getRound7Order()!=null) {
+                item.setRound7Rate(getRoundRate(item.getRound7Order(), item.getTotalNum()));
+                item.setRound7Unit(new BigDecimal(getRoundUnit(item.getRound7Money(), item.getRound7Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if (item.getRound8Order() != null) {
+                item.setRound8Rate(getRoundRate(item.getRound8Order(), item.getTotalNum()));
+                item.setRound8Unit(new BigDecimal(getRoundUnit(item.getRound8Money(), item.getRound8Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+            if (item.getRound9Order() != null) {
+                item.setRound9Rate(getRoundRate(item.getRound9Order(), item.getTotalNum()));
+                item.setRound9Unit(new BigDecimal(getRoundUnit(item.getRound9Money(), item.getRound9Order())).setScale(3, RoundingMode.HALF_UP));
+            }
+
+        }
+
+        ExcelUtil<CompanyTcmStatisticsExportVO> util = new ExcelUtil<CompanyTcmStatisticsExportVO>(CompanyTcmStatisticsExportVO.class);
+        return util.exportExcel(list, "statisticsScheduleReport");
+    }
+
+
+
+    /**
+     * 查询可用中医档期列表
+     */
+    @GetMapping("/getScheduleList")
+    public TableDataInfo getScheduleList()
+    {
+        startPage();
+        List<CompanyTcmSchedule> list = companyTcmScheduleService.selectUseableScheduleList();
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询中医档期列表
+     */
+    @GetMapping("/getAllScheduleList")
+    public TableDataInfo getAllScheduleList()
+    {
+        startPage();
+        List<CompanyTcmSchedule> list = companyTcmScheduleService.selectCompanyTcmScheduleList(new CompanyTcmSchedule());
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取中医档期业绩报表详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:scheduleReport:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(companyTcmReportService.selectCompanyTcmReportById(id));
+    }
+
+    public String getRoundRate(Long roundOrder,Long totalNum){
+        String sorStr="0%";
+        if(totalNum.longValue()>0){
+            sorStr=String.format("%.3f", roundOrder.doubleValue()/totalNum*100.0).toString()+"%";
+        }
+        return sorStr;
+    }
+
+    public double getRoundUnit(BigDecimal roundMoney,Long roundOrder){
+        double sorNum=0;
+        if(roundOrder.longValue()>0){
+            sorNum=roundMoney.doubleValue()/roundOrder*1.0;
+        }
+        return sorNum;
+    }
+
+
+    public double getLongRate(double num1,Long num2){
+        double sorNum=0;
+        if(num2.longValue()>0){
+            sorNum=num1/num2*1.0;
+        }
+        return sorNum;
+    }
+
+
+}

+ 130 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyTcmScheduleController.java

@@ -0,0 +1,130 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import cn.hutool.core.util.IdUtil;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyRecharge;
+import com.fs.core.security.LoginUser;
+import com.fs.core.web.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyTcmSchedule;
+import com.fs.company.service.ICompanyTcmScheduleService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 中医档期管理Controller
+ *
+ * @author fs
+ * @date 2023-09-05
+ */
+@RestController
+@RequestMapping("/company/schedule")
+public class CompanyTcmScheduleController extends BaseController
+{
+    @Autowired
+    private ICompanyTcmScheduleService companyTcmScheduleService;
+
+    @Autowired
+    private TokenService tokenService;
+    /**
+     * 查询中医档期管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyTcmSchedule companyTcmSchedule)
+    {
+        startPage();
+        List<CompanyTcmSchedule> list = companyTcmScheduleService.selectCompanyTcmScheduleList(companyTcmSchedule);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/getTcmScheduleList")
+    public R getCompanyTcmScheduleList()
+    {
+        CompanyTcmSchedule map = new CompanyTcmSchedule();
+        map.setStatus(1L);
+        List<CompanyTcmSchedule> list = companyTcmScheduleService.selectCompanyTcmScheduleList(map);
+        return R.ok().put("data",list);
+    }
+
+    /**
+     * 导出中医档期管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:export')")
+    @Log(title = "中医档期管理", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyTcmSchedule companyTcmSchedule)
+    {
+        List<CompanyTcmSchedule> list = companyTcmScheduleService.selectCompanyTcmScheduleList(companyTcmSchedule);
+        ExcelUtil<CompanyTcmSchedule> util = new ExcelUtil<CompanyTcmSchedule>(CompanyTcmSchedule.class);
+        return util.exportExcel(list, "schedule");
+    }
+
+    /**
+     * 获取中医档期管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(companyTcmScheduleService.selectCompanyTcmScheduleById(id));
+    }
+
+    /**
+     * 新增中医档期管理
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:add')")
+    @Log(title = "中医档期管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyTcmSchedule companyTcmSchedule)
+    {
+
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        List<CompanyTcmSchedule> scheduleList=companyTcmScheduleService.selectCompanyTcmScheduleList(companyTcmSchedule);
+        if(scheduleList.size()>0){
+            return AjaxResult.error("档期名称已经存在");
+        }
+        companyTcmSchedule.setCreateUserId(loginUser.getUser().getUserId());
+        //companyTcmSchedule.setUpdateUserId(loginUser.getUser().getUserId());
+        return toAjax(companyTcmScheduleService.insertCompanyTcmSchedule(companyTcmSchedule));
+    }
+
+    /**
+     * 修改中医档期管理
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:edit')")
+    @Log(title = "中医档期管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyTcmSchedule companyTcmSchedule)
+    {
+        return toAjax(companyTcmScheduleService.updateCompanyTcmSchedule(companyTcmSchedule));
+    }
+
+    /**
+     * 删除中医档期管理
+     */
+    @PreAuthorize("@ss.hasPermi('company:schedule:remove')")
+    @Log(title = "中医档期管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(companyTcmScheduleService.deleteCompanyTcmScheduleByIds(ids));
+    }
+}

+ 142 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyUserController.java

@@ -0,0 +1,142 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.constant.UserConstants;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.core.security.LoginUser;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyUserService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 企业员工信息Controller
+ *
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyUser")
+public class CompanyUserController extends BaseController
+{
+    @Autowired
+    private ICompanyUserService companyUserService;
+
+    /**
+     * 查询企业员工信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyUser companyUser)
+    {
+        startPage();
+        List<CompanyUser> list = companyUserService.selectCompanyUserList(companyUser);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出企业员工信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:export')")
+    @Log(title = "企业员工信息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyUser companyUser)
+    {
+        List<CompanyUser> list = companyUserService.selectCompanyUserList(companyUser);
+        ExcelUtil<CompanyUser> util = new ExcelUtil<CompanyUser>(CompanyUser.class);
+        return util.exportExcel(list, "companyUser");
+    }
+
+    /**
+     * 获取所有的销售列表
+     * @param companyId
+     * @return
+     */
+    @GetMapping("/getUserList")
+    public R getUserList(@RequestParam("companyId") Long companyId)
+    {
+        CompanyUser map=new CompanyUser();
+        map.setCompanyId(companyId);
+        List<CompanyUser> list = companyUserService.selectCompanyUserList(map);
+        return  R.ok().put("data",list);
+    }
+    /**
+     * 获取企业员工信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:query')")
+    @GetMapping(value = "/{userId}")
+    public AjaxResult getInfo(@PathVariable("userId") Long userId)
+    {
+        return AjaxResult.success(companyUserService.selectCompanyUserById(userId));
+    }
+
+    /**
+     * 新增企业员工信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:add')")
+    @Log(title = "企业员工信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyUser companyUser)
+    {
+        if (UserConstants.NOT_UNIQUE.equals(companyUserService.checkUserNameUnique(companyUser.getUserName())))
+        {
+            return AjaxResult.error("新增用户'" + companyUser.getUserName() + "'失败,登录账号已存在");
+        }
+        return toAjax(companyUserService.insertCompanyUser(companyUser));
+    }
+
+    /**
+     * 修改企业员工信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:edit')")
+    @Log(title = "企业员工信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyUser companyUser)
+    {
+        return toAjax(companyUserService.updateCompanyUser(companyUser));
+    }
+
+    /**
+     * 删除企业员工信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUser:remove')")
+    @Log(title = "企业员工信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{userIds}")
+    public AjaxResult remove(@PathVariable Long[] userIds)
+    {
+        return toAjax(companyUserService.deleteCompanyUserByIds(userIds));
+    }
+
+    @GetMapping("/getAllUserlist")
+    public R getAllUserlist(@RequestParam Long companyId)
+    {
+        CompanyUser map=new CompanyUser();
+        map.setCompanyId(companyId);
+        List<CompanyUser> list = companyUserService.selectCompanyUserList(map);
+        return R.ok().put("data",list);
+    }
+
+    @GetMapping("/getAllUserListLimit")
+    public R getAllUserListLimit(@RequestParam(required = false) Long companyId,
+                                 @RequestParam(required = false) String keywords){
+        List<CompanyUser> list = companyUserService.getAllUserListLimit(companyId,keywords);
+        return R.ok().put("data", list);
+    }
+
+    @GetMapping("/getUserListByDeptId")
+    public R getUserListByDeptId(CompanyUser user)
+    {
+
+        List<CompanyUser> list = companyUserService.getUserListByDeptId(user);
+        return R.ok().put("data",list);
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyUserPostController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyUserPost;
+import com.fs.company.service.ICompanyUserPostService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 用户与岗位关联Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyUserPost")
+public class CompanyUserPostController extends BaseController
+{
+    @Autowired
+    private ICompanyUserPostService companyUserPostService;
+
+    /**
+     * 查询用户与岗位关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyUserPost companyUserPost)
+    {
+        startPage();
+        List<CompanyUserPost> list = companyUserPostService.selectCompanyUserPostList(companyUserPost);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户与岗位关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:export')")
+    @Log(title = "用户与岗位关联", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyUserPost companyUserPost)
+    {
+        List<CompanyUserPost> list = companyUserPostService.selectCompanyUserPostList(companyUserPost);
+        ExcelUtil<CompanyUserPost> util = new ExcelUtil<CompanyUserPost>(CompanyUserPost.class);
+        return util.exportExcel(list, "companyUserPost");
+    }
+
+    /**
+     * 获取用户与岗位关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:query')")
+    @GetMapping(value = "/{userId}")
+    public AjaxResult getInfo(@PathVariable("userId") Long userId)
+    {
+        return AjaxResult.success(companyUserPostService.selectCompanyUserPostById(userId));
+    }
+
+    /**
+     * 新增用户与岗位关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:add')")
+    @Log(title = "用户与岗位关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyUserPost companyUserPost)
+    {
+        return toAjax(companyUserPostService.insertCompanyUserPost(companyUserPost));
+    }
+
+    /**
+     * 修改用户与岗位关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:edit')")
+    @Log(title = "用户与岗位关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyUserPost companyUserPost)
+    {
+        return toAjax(companyUserPostService.updateCompanyUserPost(companyUserPost));
+    }
+
+    /**
+     * 删除用户与岗位关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserPost:remove')")
+    @Log(title = "用户与岗位关联", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{userIds}")
+    public AjaxResult remove(@PathVariable Long[] userIds)
+    {
+        return toAjax(companyUserPostService.deleteCompanyUserPostByIds(userIds));
+    }
+}

+ 103 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyUserRoleController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyUserRole;
+import com.fs.company.service.ICompanyUserRoleService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 用户和角色关联Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyUserRole")
+public class CompanyUserRoleController extends BaseController
+{
+    @Autowired
+    private ICompanyUserRoleService companyUserRoleService;
+
+    /**
+     * 查询用户和角色关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyUserRole companyUserRole)
+    {
+        startPage();
+        List<CompanyUserRole> list = companyUserRoleService.selectCompanyUserRoleList(companyUserRole);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户和角色关联列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:export')")
+    @Log(title = "用户和角色关联", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyUserRole companyUserRole)
+    {
+        List<CompanyUserRole> list = companyUserRoleService.selectCompanyUserRoleList(companyUserRole);
+        ExcelUtil<CompanyUserRole> util = new ExcelUtil<CompanyUserRole>(CompanyUserRole.class);
+        return util.exportExcel(list, "companyUserRole");
+    }
+
+    /**
+     * 获取用户和角色关联详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:query')")
+    @GetMapping(value = "/{userId}")
+    public AjaxResult getInfo(@PathVariable("userId") Long userId)
+    {
+        return AjaxResult.success(companyUserRoleService.selectCompanyUserRoleById(userId));
+    }
+
+    /**
+     * 新增用户和角色关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:add')")
+    @Log(title = "用户和角色关联", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyUserRole companyUserRole)
+    {
+        return toAjax(companyUserRoleService.insertCompanyUserRole(companyUserRole));
+    }
+
+    /**
+     * 修改用户和角色关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:edit')")
+    @Log(title = "用户和角色关联", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyUserRole companyUserRole)
+    {
+        return toAjax(companyUserRoleService.updateCompanyUserRole(companyUserRole));
+    }
+
+    /**
+     * 删除用户和角色关联
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyUserRole:remove')")
+    @Log(title = "用户和角色关联", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{userIds}")
+    public AjaxResult remove(@PathVariable Long[] userIds)
+    {
+        return toAjax(companyUserRoleService.deleteCompanyUserRoleByIds(userIds));
+    }
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceApiController.java

@@ -0,0 +1,106 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.voice.service.IVoiceService;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceApi;
+import com.fs.company.service.ICompanyVoiceApiService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 呼叫接口Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyVoiceApi")
+public class CompanyVoiceApiController extends BaseController {
+    @Autowired
+    private ICompanyVoiceApiService companyVoiceApiService;
+    @Autowired
+    private IVoiceService voiceService;
+
+    /**
+     * 查询呼叫接口列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceApi companyVoiceApi) {
+        startPage();
+        List<CompanyVoiceApi> list = companyVoiceApiService.selectCompanyVoiceApiList(companyVoiceApi);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出呼叫接口列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:export')")
+    @Log(title = "呼叫接口", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceApi companyVoiceApi) {
+        List<CompanyVoiceApi> list = companyVoiceApiService.selectCompanyVoiceApiList(companyVoiceApi);
+        ExcelUtil<CompanyVoiceApi> util = new ExcelUtil<CompanyVoiceApi>(CompanyVoiceApi.class);
+        return util.exportExcel(list, "companyVoiceApi");
+    }
+
+    /**
+     * 获取呼叫接口详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:query')")
+    @GetMapping(value = "/{apiId}")
+    public AjaxResult getInfo(@PathVariable("apiId") Long apiId) {
+        return AjaxResult.success(companyVoiceApiService.selectCompanyVoiceApiById(apiId));
+    }
+
+    /**
+     * 新增呼叫接口
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:add')")
+    @Log(title = "呼叫接口", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoiceApi companyVoiceApi) {
+        return toAjax(companyVoiceApiService.insertCompanyVoiceApi(companyVoiceApi));
+    }
+
+    /**
+     * 修改呼叫接口
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:edit')")
+    @Log(title = "呼叫接口", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoiceApi companyVoiceApi) {
+        return toAjax(companyVoiceApiService.updateCompanyVoiceApi(companyVoiceApi));
+    }
+
+    /**
+     * 删除呼叫接口
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:remove')")
+    @Log(title = "呼叫接口", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{apiIds}")
+    public AjaxResult remove(@PathVariable Long[] apiIds) {
+        return toAjax(companyVoiceApiService.deleteCompanyVoiceApiByIds(apiIds));
+    }
+
+    @GetMapping("/getVoiceApiList")
+    public R getVoiceApiList() {
+        CompanyVoiceApi map = new CompanyVoiceApi();
+        map.setStatus(1);
+        List<CompanyVoiceApi> list = companyVoiceApiService.selectCompanyVoiceApiList(map);
+        return R.ok().put("data", list);
+    }
+
+
+}

+ 111 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceBlacklistController.java

@@ -0,0 +1,111 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.utils.ParseUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceBlacklist;
+import com.fs.company.service.ICompanyVoiceBlacklistService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 黑名单Controller
+ *
+ * @author fs
+ * @date 2023-02-23
+ */
+@RestController
+@RequestMapping("/company/companyVoiceBlacklist")
+public class CompanyVoiceBlacklistController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceBlacklistService companyVoiceBlacklistService;
+
+    /**
+     * 查询黑名单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceBlacklist companyVoiceBlacklist)
+    {
+        startPage();
+        List<CompanyVoiceBlacklist> list = companyVoiceBlacklistService.selectCompanyVoiceBlacklistList(companyVoiceBlacklist);
+        for (CompanyVoiceBlacklist blacklist : list){
+            blacklist.setMobile(ParseUtils.parsePhone(blacklist.getMobile()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出黑名单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:export')")
+    @Log(title = "黑名单", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceBlacklist companyVoiceBlacklist)
+    {
+        List<CompanyVoiceBlacklist> list = companyVoiceBlacklistService.selectCompanyVoiceBlacklistList(companyVoiceBlacklist);
+        for (CompanyVoiceBlacklist blacklist : list){
+            blacklist.setMobile(ParseUtils.parsePhone(blacklist.getMobile()));
+        }
+        ExcelUtil<CompanyVoiceBlacklist> util = new ExcelUtil<CompanyVoiceBlacklist>(CompanyVoiceBlacklist.class);
+        return util.exportExcel(list, "companyVoiceBlacklist");
+    }
+
+    /**
+     * 获取黑名单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:query')")
+    @GetMapping(value = "/{blacklistId}")
+    public AjaxResult getInfo(@PathVariable("blacklistId") Long blacklistId)
+    {
+        return AjaxResult.success(companyVoiceBlacklistService.selectCompanyVoiceBlacklistById(blacklistId));
+    }
+
+    /**
+     * 新增黑名单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:add')")
+    @Log(title = "黑名单", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoiceBlacklist companyVoiceBlacklist)
+    {
+        return toAjax(companyVoiceBlacklistService.insertCompanyVoiceBlacklist(companyVoiceBlacklist));
+    }
+
+    /**
+     * 修改黑名单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:edit')")
+    @Log(title = "黑名单", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoiceBlacklist companyVoiceBlacklist)
+    {
+        return toAjax(companyVoiceBlacklistService.updateCompanyVoiceBlacklist(companyVoiceBlacklist));
+    }
+
+    /**
+     * 删除黑名单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceBlacklist:remove')")
+    @Log(title = "黑名单", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{blacklistIds}")
+    public AjaxResult remove(@PathVariable Long[] blacklistIds)
+    {
+        return toAjax(companyVoiceBlacklistService.deleteCompanyVoiceBlacklistByIds(blacklistIds));
+    }
+}

+ 153 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceCallerController.java

@@ -0,0 +1,153 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.param.CompanyVoiceCallerImportParam;
+import com.fs.company.param.CompanyVoiceCallerParam;
+import com.fs.company.param.CompanyVoiceCallerRecoverParam;
+import com.fs.company.vo.CompanyVoiceCallerListVO;
+import com.fs.core.security.LoginUser;
+import com.fs.crm.param.CrmCustomeRecoverParam;
+import com.fs.crm.param.CrmLineCustomerImportParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceCaller;
+import com.fs.company.service.ICompanyVoiceCallerService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 企业用户坐席Controller
+ *
+ * @author fs
+ * @date 2023-02-23
+ */
+@RestController
+@RequestMapping("/company/companyVoiceCaller")
+public class CompanyVoiceCallerController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceCallerService companyVoiceCallerService;
+
+    /**
+     * 查询企业用户坐席列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceCallerParam param)
+    {
+        startPage();
+        List<CompanyVoiceCallerListVO> list = companyVoiceCallerService.selectCompanyVoiceCallerListVO(param);
+        for(CompanyVoiceCallerListVO vo :list){
+            vo.setMobile(ParseUtils.parsePhone(vo.getMobile()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出企业用户坐席列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:export')")
+    @Log(title = "企业用户坐席", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceCallerParam param)
+    {
+        List<CompanyVoiceCallerListVO> list = companyVoiceCallerService.selectCompanyVoiceCallerListVO(param);
+        ExcelUtil<CompanyVoiceCallerListVO> util = new ExcelUtil<CompanyVoiceCallerListVO>(CompanyVoiceCallerListVO.class);
+        return util.exportExcel(list, "companyVoiceCaller");
+    }
+
+    /**
+     * 获取企业用户坐席详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:query')")
+    @GetMapping(value = "/{callingId}")
+    public AjaxResult getInfo(@PathVariable("callingId") Long callingId)
+    {
+        return AjaxResult.success(companyVoiceCallerService.selectCompanyVoiceCallerById(callingId));
+    }
+
+    /**
+     * 新增企业用户坐席
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:add')")
+    @Log(title = "企业用户坐席", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoiceCaller companyVoiceCaller)
+    {
+        return toAjax(companyVoiceCallerService.insertCompanyVoiceCaller(companyVoiceCaller));
+    }
+
+    /**
+     * 修改企业用户坐席
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:edit')")
+    @Log(title = "企业用户坐席", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoiceCaller companyVoiceCaller)
+    {
+        return toAjax(companyVoiceCallerService.updateCompanyVoiceCaller(companyVoiceCaller));
+    }
+
+    /**
+     * 删除企业用户坐席
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:remove')")
+    @Log(title = "企业用户坐席", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{callingIds}")
+    public AjaxResult remove(@PathVariable Long[] callingIds)
+    {
+        return toAjax(companyVoiceCallerService.deleteCompanyVoiceCallerByIds(callingIds));
+    }
+
+
+    @Log(title = "导入线索客户", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:import')")
+    @PostMapping("/importData")
+    public AjaxResult importLineData(MultipartFile file) throws Exception
+    {
+        ExcelUtil<CompanyVoiceCallerImportParam> util = new ExcelUtil<CompanyVoiceCallerImportParam>(CompanyVoiceCallerImportParam.class);
+        List<CompanyVoiceCallerImportParam> list = util.importExcel(file.getInputStream());
+        String message = companyVoiceCallerService.importCompanyVoiceCaller(list);
+        return AjaxResult.success(message);
+    }
+    //下载模板
+    @GetMapping("/importTemplate")
+    public AjaxResult importLineTemplate()
+    {
+        ExcelUtil<CompanyVoiceCallerImportParam> util = new ExcelUtil<CompanyVoiceCallerImportParam>(CompanyVoiceCallerImportParam.class);
+        return util.importTemplateExcel("分机号数据");
+    }
+
+    //回收
+    @PostMapping("/recover")
+    public R recover(@RequestBody CompanyVoiceCallerRecoverParam param)
+    {
+        CompanyVoiceCaller caller=companyVoiceCallerService.selectCompanyVoiceCallerById(param.getCallerId());
+        caller.setCompanyId(0l);
+        caller.setCompanyUserId(0l);
+        caller.setMobile("");
+        caller.setStatus(1);
+        companyVoiceCallerService.updateCompanyVoiceCaller(caller);
+        return R.ok();
+
+    }
+}

+ 175 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceConfigController.java

@@ -0,0 +1,175 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import cn.hutool.json.JSONUtil;
+import com.fs.common.core.domain.R;
+import com.fs.company.config.CompanyVoiceCalleeConfig;
+import com.fs.company.config.CompanyVoiceCallerConfig;
+import com.fs.company.param.CompanyVoiceConfigParam;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.CompanyVoiceConfigListVO;
+import com.fs.company.vo.CompanyVoiceConfigVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceConfig;
+import com.fs.company.service.ICompanyVoiceConfigService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 呼叫频率配置Controller
+ * 
+ * @author fs
+ * @date 2021-11-13
+ */
+@RestController
+@RequestMapping("/company/companyVoiceConfig")
+public class CompanyVoiceConfigController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceConfigService companyVoiceConfigService;
+    @Autowired
+    private ICompanyService companyService;
+    /**
+     * 查询呼叫频率配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceConfig companyVoiceConfig)
+    {
+        startPage();
+        List<CompanyVoiceConfigListVO> list = companyVoiceConfigService.selectCompanyVoiceConfigListVO(companyVoiceConfig);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出呼叫频率配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:export')")
+    @Log(title = "呼叫频率配置", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceConfig companyVoiceConfig)
+    {
+        List<CompanyVoiceConfig> list = companyVoiceConfigService.selectCompanyVoiceConfigList(companyVoiceConfig);
+        ExcelUtil<CompanyVoiceConfig> util = new ExcelUtil<CompanyVoiceConfig>(CompanyVoiceConfig.class);
+        return util.exportExcel(list, "companyVoiceConfig");
+    }
+
+    /**
+     * 获取呼叫频率配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:query')")
+    @GetMapping(value = "/{configId}")
+    public AjaxResult getInfo(@PathVariable("configId") Long configId)
+    {
+        CompanyVoiceConfig config=companyVoiceConfigService.selectCompanyVoiceConfigById(configId);
+        CompanyVoiceCalleeConfig voiceCalleeConfigBO=JSONUtil.toBean(config.getCalleeJson(), CompanyVoiceCalleeConfig.class);
+        CompanyVoiceCallerConfig voiceCallerConfigBO=JSONUtil.toBean(config.getCallerJson(), CompanyVoiceCallerConfig.class);
+
+
+        CompanyVoiceConfigVO vo=new CompanyVoiceConfigVO();
+        vo.setCompanyId(config.getCompanyId());
+        vo.setConfigId(config.getConfigId());
+        vo.setCalleeDay(voiceCalleeConfigBO.getCalleeDay());
+        vo.setCalleeHour(voiceCalleeConfigBO.getCalleeHour());
+        vo.setCalleeWeek(voiceCalleeConfigBO.getCalleeWeek());
+        vo.setCalleeMinute(voiceCalleeConfigBO.getCalleeMinute());
+        vo.setCalleeMonth(voiceCalleeConfigBO.getCalleeMonth());
+
+        vo.setCallerDay(voiceCallerConfigBO.getCallerDay());
+        vo.setCallerHour(voiceCallerConfigBO.getCallerHour());
+        vo.setCallerWeek(voiceCallerConfigBO.getCallerWeek());
+        vo.setCallerMonth(voiceCallerConfigBO.getCallerMonth());
+        vo.setCallerMinute(voiceCallerConfigBO.getCallerMinute());
+
+        return AjaxResult.success(vo);
+    }
+
+    /**
+     * 新增呼叫频率配置
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:add')")
+    @Log(title = "呼叫频率配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public R add(@RequestBody CompanyVoiceConfigParam companyVoiceConfig)
+    {
+        //查询企业是否存在
+        CompanyVoiceConfig config=companyVoiceConfigService.selectCompanyVoiceConfigByCompanyId(companyVoiceConfig.getCompanyId());
+        if(config!=null){
+            return R.error("企业已存在");
+        }
+        CompanyVoiceCalleeConfig voiceCalleeConfigBO=new CompanyVoiceCalleeConfig();
+        voiceCalleeConfigBO.setCalleeDay(companyVoiceConfig.getCalleeDay());
+        voiceCalleeConfigBO.setCalleeHour(companyVoiceConfig.getCalleeHour());
+        voiceCalleeConfigBO.setCalleeMinute(companyVoiceConfig.getCalleeMinute());
+        voiceCalleeConfigBO.setCalleeMonth(companyVoiceConfig.getCalleeMonth());
+        voiceCalleeConfigBO.setCalleeWeek(companyVoiceConfig.getCalleeWeek());
+
+        CompanyVoiceCallerConfig voiceCallerConfigBO=new CompanyVoiceCallerConfig();
+        voiceCallerConfigBO.setCallerDay(companyVoiceConfig.getCallerDay());
+        voiceCallerConfigBO.setCallerHour(companyVoiceConfig.getCallerHour());
+        voiceCallerConfigBO.setCallerMinute(companyVoiceConfig.getCallerMinute());
+        voiceCallerConfigBO.setCallerWeek(companyVoiceConfig.getCallerWeek());
+        voiceCallerConfigBO.setCallerMonth(companyVoiceConfig.getCallerMonth());
+        config=new CompanyVoiceConfig();
+        config.setCompanyId(companyVoiceConfig.getCompanyId());
+        config.setCalleeJson(JSONUtil.toJsonStr(voiceCalleeConfigBO));
+        config.setCallerJson(JSONUtil.toJsonStr(voiceCallerConfigBO));
+        companyVoiceConfigService.insertCompanyVoiceConfig(config);
+        return R.ok("操作成功");
+    }
+
+    /**
+     * 修改呼叫频率配置
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:edit')")
+    @Log(title = "呼叫频率配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public R edit(@RequestBody CompanyVoiceConfigParam companyVoiceConfig)
+    {
+
+        CompanyVoiceCalleeConfig voiceCalleeConfigBO=new CompanyVoiceCalleeConfig();
+        voiceCalleeConfigBO.setCalleeDay(companyVoiceConfig.getCalleeDay());
+        voiceCalleeConfigBO.setCalleeHour(companyVoiceConfig.getCalleeHour());
+        voiceCalleeConfigBO.setCalleeMinute(companyVoiceConfig.getCalleeMinute());
+        voiceCalleeConfigBO.setCalleeMonth(companyVoiceConfig.getCalleeMonth());
+        voiceCalleeConfigBO.setCalleeWeek(companyVoiceConfig.getCalleeWeek());
+
+        CompanyVoiceCallerConfig voiceCallerConfigBO=new CompanyVoiceCallerConfig();
+        voiceCallerConfigBO.setCallerDay(companyVoiceConfig.getCallerDay());
+        voiceCallerConfigBO.setCallerHour(companyVoiceConfig.getCallerHour());
+        voiceCallerConfigBO.setCallerMinute(companyVoiceConfig.getCallerMinute());
+        voiceCallerConfigBO.setCallerWeek(companyVoiceConfig.getCallerWeek());
+        voiceCallerConfigBO.setCallerMonth(companyVoiceConfig.getCallerMonth());
+        CompanyVoiceConfig config=new CompanyVoiceConfig();
+        config.setConfigId(companyVoiceConfig.getConfigId());
+        config.setCalleeJson(JSONUtil.toJsonStr(voiceCalleeConfigBO));
+        config.setCallerJson(JSONUtil.toJsonStr(voiceCallerConfigBO));
+        companyVoiceConfigService.updateCompanyVoiceConfig(config);
+        return R.ok("修改成功");
+    }
+
+    /**
+     * 删除呼叫频率配置
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceConfig:remove')")
+    @Log(title = "呼叫频率配置", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{configIds}")
+    public AjaxResult remove(@PathVariable Long[] configIds)
+    {
+        return toAjax(companyVoiceConfigService.deleteCompanyVoiceConfigByIds(configIds));
+    }
+}

+ 134 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceController.java

@@ -0,0 +1,134 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.company.vo.CompanyVoiceListVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.domain.Company;
+import com.fs.company.param.CompanyPackageBuyParam;
+import com.fs.company.service.ICompanyVoicePackageOrderService;
+import com.fs.company.service.impl.CompanyVoicePackageOrderServiceImpl;
+import com.fs.core.security.LoginUser;
+import org.apache.http.util.Asserts;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoice;
+import com.fs.company.service.ICompanyVoiceService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 企业通话Controller
+ *
+ * @author fs
+ * @date 2023-02-23
+ */
+@RestController
+@RequestMapping("/company/companyVoice")
+public class CompanyVoiceController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceService companyVoiceService;
+    @Autowired
+    private ICompanyVoicePackageOrderService voicePackageOrderService;
+    /**
+     * 查询企业通话列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoice companyVoice)
+    {
+        startPage();
+        List<CompanyVoiceListVO> list = companyVoiceService.selectCompanyVoiceListVO(companyVoice);
+        for (CompanyVoiceListVO vo : list){
+            vo.setUseTimes(vo.getTotalTimes()-vo.getTimes());
+        }
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:buy')")
+    @PostMapping("/buy")
+    @RepeatSubmit
+    public R buy(@RequestBody CompanyPackageBuyParam param)
+    {
+        logger.info("购买语音套餐请求参数: companyId={}, packageId={}", param.getCompanyId(), param.getPackageId());
+        Asserts.notNull(param,"请求参数不能为空!");
+        Asserts.notNull(param.getCompanyId(),"公司id不能为空!");
+        Asserts.notNull(param.getPackageId(),"套餐id不能为空!");
+
+        return voicePackageOrderService.buy(param);
+    }
+
+    /**
+     * 导出企业通话列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:export')")
+    @Log(title = "企业通话", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoice companyVoice)
+    {
+        List<CompanyVoice> list = companyVoiceService.selectCompanyVoiceList(companyVoice);
+        ExcelUtil<CompanyVoice> util = new ExcelUtil<CompanyVoice>(CompanyVoice.class);
+        return util.exportExcel(list, "companyVoice");
+    }
+
+    /**
+     * 获取企业通话详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:query')")
+    @GetMapping(value = "/{voiceId}")
+    public AjaxResult getInfo(@PathVariable("voiceId") Long voiceId)
+    {
+        return AjaxResult.success(companyVoiceService.selectCompanyVoiceById(voiceId));
+    }
+
+    /**
+     * 新增企业通话
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:add')")
+    @Log(title = "企业通话", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoice companyVoice)
+    {
+        return toAjax(companyVoiceService.insertCompanyVoice(companyVoice));
+    }
+
+    /**
+     * 修改企业通话
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:edit')")
+    @Log(title = "企业通话", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoice companyVoice)
+    {
+        return toAjax(companyVoiceService.updateCompanyVoice(companyVoice));
+    }
+
+    /**
+     * 删除企业通话
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoice:remove')")
+    @Log(title = "企业通话", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{voiceIds}")
+    public AjaxResult remove(@PathVariable Long[] voiceIds)
+    {
+        return toAjax(companyVoiceService.deleteCompanyVoiceByIds(voiceIds));
+    }
+}

+ 133 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceLogsController.java

@@ -0,0 +1,133 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.company.param.CompanyVoiceLogsParam;
+import com.fs.company.vo.CompanyVoiceLogsExportVO;
+import com.fs.company.vo.CompanyVoiceLogsVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceLogs;
+import com.fs.company.service.ICompanyVoiceLogsService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 通话记录Controller
+ *
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyVoiceLogs")
+public class CompanyVoiceLogsController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceLogsService companyVoiceLogsService;
+
+    /**
+     * 查询通话记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceLogsParam param)
+    {
+        startPage();
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyVoiceLogsVO> list = companyVoiceLogsService.selectCompanyVoiceLogsVOList(param);
+        for(CompanyVoiceLogsVO vo : list){
+            vo.setCalleePhone(ParseUtils.parsePhone(vo.getCalleePhone()));
+            vo.setCallerPhone(ParseUtils.parsePhone(vo.getCallerPhone()));
+            vo.setDisplayCalleeNumber(ParseUtils.parsePhone(vo.getDisplayCalleeNumber()));
+            vo.setDisplayCallerNumber(ParseUtils.parsePhone(vo.getDisplayCallerNumber()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出通话记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:export')")
+    @Log(title = "通话记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceLogsParam param)
+    {
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
+        }
+        if(!StringUtils.isEmpty(param.getDateRange())){
+            param.setStartTimeList(param.getDateRange().split("--"));
+        }
+        List<CompanyVoiceLogsExportVO> list = companyVoiceLogsService.selectCompanyVoiceLogsExportVOList(param);
+        for(CompanyVoiceLogsExportVO vo : list){
+            vo.setCalleePhone(ParseUtils.parsePhone(vo.getCalleePhone()));
+            vo.setCallerPhone(ParseUtils.parsePhone(vo.getCallerPhone()));
+            vo.setDisplayCalleeNumber(ParseUtils.parsePhone(vo.getDisplayCalleeNumber()));
+            vo.setDisplayCallerNumber(ParseUtils.parsePhone(vo.getDisplayCallerNumber()));
+        }
+        ExcelUtil<CompanyVoiceLogsExportVO> util = new ExcelUtil<CompanyVoiceLogsExportVO>(CompanyVoiceLogsExportVO.class);
+        return util.exportExcel(list, "通话记录");
+    }
+
+    /**
+     * 获取通话记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:query')")
+    @GetMapping(value = "/{voiceId}")
+    public AjaxResult getInfo(@PathVariable("voiceId") Long voiceId)
+    {
+        return AjaxResult.success(companyVoiceLogsService.selectCompanyVoiceLogsById(voiceId));
+    }
+
+    /**
+     * 新增通话记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:add')")
+    @Log(title = "通话记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoiceLogs companyVoiceLogs)
+    {
+        return toAjax(companyVoiceLogsService.insertCompanyVoiceLogs(companyVoiceLogs));
+    }
+
+    /**
+     * 修改通话记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:edit')")
+    @Log(title = "通话记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoiceLogs companyVoiceLogs)
+    {
+        return toAjax(companyVoiceLogsService.updateCompanyVoiceLogs(companyVoiceLogs));
+    }
+
+    /**
+     * 删除通话记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:remove')")
+    @Log(title = "通话记录", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{voiceIds}")
+    public AjaxResult remove(@PathVariable Long[] voiceIds)
+    {
+        return toAjax(companyVoiceLogsService.deleteCompanyVoiceLogsByIds(voiceIds));
+    }
+}

+ 134 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoiceMobileController.java

@@ -0,0 +1,134 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.common.utils.ServletUtils;
+import com.fs.company.vo.CompanyVoiceMobileVO;
+import com.fs.core.security.LoginUser;
+import com.fs.crm.param.CrmLineCustomerImportParam;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoiceMobile;
+import com.fs.company.service.ICompanyVoiceMobileService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 中间号Controller
+ * 
+ * @author fs
+ * @date 2021-10-04
+ */
+@RestController
+@RequestMapping("/company/companyVoiceMobile")
+public class CompanyVoiceMobileController extends BaseController
+{
+    @Autowired
+    private ICompanyVoiceMobileService companyVoiceMobileService;
+
+    /**
+     * 查询中间号列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceMobile companyVoiceMobile)
+    {
+        startPage();
+        List<CompanyVoiceMobileVO> list = companyVoiceMobileService.selectCompanyVoiceMobileVOList(companyVoiceMobile);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出中间号列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:export')")
+    @Log(title = "中间号", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceMobile companyVoiceMobile)
+    {
+        List<CompanyVoiceMobile> list = companyVoiceMobileService.selectCompanyVoiceMobileList(companyVoiceMobile);
+        ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
+        return util.exportExcel(list, "companyVoiceMobile");
+    }
+
+    /**
+     * 获取中间号详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:query')")
+    @GetMapping(value = "/{mobileId}")
+    public AjaxResult getInfo(@PathVariable("mobileId") Long mobileId)
+    {
+        return AjaxResult.success(companyVoiceMobileService.selectCompanyVoiceMobileById(mobileId));
+    }
+
+    /**
+     * 新增中间号
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:add')")
+    @Log(title = "中间号", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoiceMobile companyVoiceMobile)
+    {
+        if(companyVoiceMobile.getMobileType().equals(1)){
+            companyVoiceMobile.setCompanyId(0l);
+        }
+        return toAjax(companyVoiceMobileService.insertCompanyVoiceMobile(companyVoiceMobile));
+    }
+
+    /**
+     * 修改中间号
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:edit')")
+    @Log(title = "中间号", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoiceMobile companyVoiceMobile)
+    {
+        if(companyVoiceMobile.getMobileType().equals(1)){
+            companyVoiceMobile.setCompanyId(0l);
+        }
+
+        return toAjax(companyVoiceMobileService.updateCompanyVoiceMobile(companyVoiceMobile));
+    }
+
+    /**
+     * 删除中间号
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:remove')")
+    @Log(title = "中间号", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{mobileIds}")
+    public AjaxResult remove(@PathVariable Long[] mobileIds)
+    {
+        return toAjax(companyVoiceMobileService.deleteCompanyVoiceMobileByIds(mobileIds));
+    }
+
+    @Log(title = "导入线索客户", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceMobile:import')")
+    @PostMapping("/importData")
+    public AjaxResult importLineData(MultipartFile file) throws Exception
+    {
+        ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
+        List<CompanyVoiceMobile> list = util.importExcel(file.getInputStream());
+        String message = companyVoiceMobileService.importMobile(list);
+        return AjaxResult.success(message);
+    }
+    //下载模板
+    @GetMapping("/importTemplate")
+    public AjaxResult importLineTemplate()
+    {
+        ExcelUtil<CompanyVoiceMobile> util = new ExcelUtil<CompanyVoiceMobile>(CompanyVoiceMobile.class);
+        return util.importTemplateExcel("号码数据");
+    }
+}

+ 114 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoicePackageController.java

@@ -0,0 +1,114 @@
+package com.fs.company.controller;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoicePackage;
+import com.fs.company.service.ICompanyVoicePackageService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 套餐Controller
+ *
+ * @author fs
+ * @date 2023-02-23
+ */
+@RestController
+@RequestMapping("/company/companyVoicePackage")
+public class CompanyVoicePackageController extends BaseController
+{
+    @Autowired
+    private ICompanyVoicePackageService companyVoicePackageService;
+
+    /**
+     * 查询套餐列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoicePackage companyVoicePackage)
+    {
+        startPage();
+        List<CompanyVoicePackage> list = companyVoicePackageService.selectCompanyVoicePackageList(companyVoicePackage);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询套餐列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:list')")
+    @GetMapping("/listAll")
+    public AjaxResult listAll(CompanyVoicePackage companyVoicePackage)
+    {
+        List<CompanyVoicePackage> list = companyVoicePackageService.selectCompanyVoicePackageList(companyVoicePackage);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出套餐列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:export')")
+    @Log(title = "套餐", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoicePackage companyVoicePackage)
+    {
+        List<CompanyVoicePackage> list = companyVoicePackageService.selectCompanyVoicePackageList(companyVoicePackage);
+        ExcelUtil<CompanyVoicePackage> util = new ExcelUtil<CompanyVoicePackage>(CompanyVoicePackage.class);
+        return util.exportExcel(list, "companyVoicePackage");
+    }
+
+    /**
+     * 获取套餐详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:query')")
+    @GetMapping(value = "/{packageId}")
+    public AjaxResult getInfo(@PathVariable("packageId") Long packageId)
+    {
+        return AjaxResult.success(companyVoicePackageService.selectCompanyVoicePackageById(packageId));
+    }
+
+    /**
+     * 新增套餐
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:add')")
+    @Log(title = "套餐", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoicePackage companyVoicePackage)
+    {
+        return toAjax(companyVoicePackageService.insertCompanyVoicePackage(companyVoicePackage));
+    }
+
+    /**
+     * 修改套餐
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:edit')")
+    @Log(title = "套餐", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoicePackage companyVoicePackage)
+    {
+        return toAjax(companyVoicePackageService.updateCompanyVoicePackage(companyVoicePackage));
+    }
+
+    /**
+     * 删除套餐
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackage:remove')")
+    @Log(title = "套餐", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{packageIds}")
+    public AjaxResult remove(@PathVariable Long[] packageIds)
+    {
+        return toAjax(companyVoicePackageService.deleteCompanyVoicePackageByIds(packageIds));
+    }
+}

+ 106 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyVoicePackageOrderController.java

@@ -0,0 +1,106 @@
+package com.fs.company.controller;
+
+import java.util.List;
+
+import com.fs.company.param.CompanyVoicePackageOrderListParam;
+import com.fs.company.vo.CompanyVoicePackageOrderListVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyVoicePackageOrder;
+import com.fs.company.service.ICompanyVoicePackageOrderService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 套餐订单Controller
+ * 
+ * @author fs
+ * @date 2023-02-23
+ */
+@RestController
+@RequestMapping("/company/companyVoicePackageOrder")
+public class CompanyVoicePackageOrderController extends BaseController
+{
+    @Autowired
+    private ICompanyVoicePackageOrderService companyVoicePackageOrderService;
+
+    /**
+     * 查询套餐订单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoicePackageOrderListParam param)
+    {
+        startPage();
+        List<CompanyVoicePackageOrderListVO> list = companyVoicePackageOrderService.selectCompanyVoicePackageOrderListVO(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出套餐订单列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:export')")
+    @Log(title = "套餐订单", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoicePackageOrderListParam param)
+    {
+        List<CompanyVoicePackageOrderListVO> list = companyVoicePackageOrderService.selectCompanyVoicePackageOrderListVO(param);
+        ExcelUtil<CompanyVoicePackageOrderListVO> util = new ExcelUtil<CompanyVoicePackageOrderListVO>(CompanyVoicePackageOrderListVO.class);
+        return util.exportExcel(list, "companyVoicePackageOrder");
+    }
+
+    /**
+     * 获取套餐订单详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:query')")
+    @GetMapping(value = "/{orderId}")
+    public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
+    {
+        return AjaxResult.success(companyVoicePackageOrderService.selectCompanyVoicePackageOrderById(orderId));
+    }
+
+    /**
+     * 新增套餐订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:add')")
+    @Log(title = "套餐订单", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CompanyVoicePackageOrder companyVoicePackageOrder)
+    {
+        return toAjax(companyVoicePackageOrderService.insertCompanyVoicePackageOrder(companyVoicePackageOrder));
+    }
+
+    /**
+     * 修改套餐订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:edit')")
+    @Log(title = "套餐订单", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CompanyVoicePackageOrder companyVoicePackageOrder)
+    {
+        return toAjax(companyVoicePackageOrderService.updateCompanyVoicePackageOrder(companyVoicePackageOrder));
+    }
+
+    /**
+     * 删除套餐订单
+     */
+    @PreAuthorize("@ss.hasPermi('company:companyVoicePackageOrder:remove')")
+    @Log(title = "套餐订单", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{orderIds}")
+    public AjaxResult remove(@PathVariable Long[] orderIds)
+    {
+        return toAjax(companyVoicePackageOrderService.deleteCompanyVoicePackageOrderByIds(orderIds));
+    }
+}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff