committed by
donghanyang
39 changed files with 1032 additions and 4 deletions
-
39.gitignore
-
4.idea/.gitignore
-
7.idea/encodings.xml
-
10.idea/misc.xml
-
3.idea/vcs.xml
-
135pom.xml
-
18src/main/java/com/link/TestApplication.java
-
46src/main/java/com/link/config/HljwDataSourceConfig.java
-
43src/main/java/com/link/config/WechartDataSourceConfig.java
-
25src/main/java/com/link/controller/AnchorUserTypeStatController.java
-
21src/main/java/com/link/controller/CRMCountController.java
-
25src/main/java/com/link/controller/NotRegisteredController.java
-
35src/main/java/com/link/controller/UserCountController.java
-
108src/main/java/com/link/domain/Result.java
-
19src/main/java/com/link/domain/dto/AnchorUserTypeStatDTO.java
-
16src/main/java/com/link/domain/dto/CRMCountDTO.java
-
15src/main/java/com/link/domain/dto/NotRegisteredDTO.java
-
16src/main/java/com/link/domain/dto/UserCountDTO.java
-
16src/main/java/com/link/domain/vo/AnchorUserTypeStatVO.java
-
14src/main/java/com/link/domain/vo/CRMCountVO.java
-
15src/main/java/com/link/domain/vo/NotRegisteredVO.java
-
18src/main/java/com/link/domain/vo/UserCountVO.java
-
19src/main/java/com/link/mapper/UserCountMapper.java
-
15src/main/java/com/link/mapperwechart/AnchorUserTypeStatMapper.java
-
14src/main/java/com/link/mapperwechart/CRMCountMapper.java
-
15src/main/java/com/link/mapperwechart/NotRegisteredMapper.java
-
11src/main/java/com/link/service/AnchorUserTypeStatService.java
-
12src/main/java/com/link/service/CRMCountService.java
-
10src/main/java/com/link/service/NotRegisteredService.java
-
16src/main/java/com/link/service/UserCountService.java
-
22src/main/java/com/link/serviceImpl/AnchorUserTypeStatServiceImpl.java
-
23src/main/java/com/link/serviceImpl/CRMCountServiceImpl.java
-
22src/main/java/com/link/serviceImpl/NotRegisteredServiceImpl.java
-
31src/main/java/com/link/serviceImpl/UserCountServiceImpl.java
-
32src/main/resources/application.yml
-
56src/main/resources/com/link/mapper/UserCountMapper.xml
-
51src/main/resources/com/link/mapperwechart/AnchorUserTypeStatMapper.xml
-
12src/main/resources/com/link/mapperwechart/CRMCountMapper.xml
-
27src/main/resources/com/link/mapperwechart/NotRegisteredMapper.xml
@ -0,0 +1,39 @@ |
|||
target/ |
|||
!.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
.kotlin |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea/modules.xml |
|||
.idea/jarRepositories.xml |
|||
.idea/compiler.xml |
|||
.idea/libraries/ |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### Eclipse ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
|||
|
|||
### Mac OS ### |
|||
.DS_Store |
|||
@ -1,7 +1,7 @@ |
|||
# 默认忽略的文件 |
|||
# Default ignored files |
|||
/shelf/ |
|||
/workspace.xml |
|||
# 基于编辑器的 HTTP 客户端请求 |
|||
# Editor-based HTTP Client requests |
|||
/httpRequests/ |
|||
# Datasource local storage ignored files |
|||
/dataSources/ |
|||
|
|||
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="Encoding"> |
|||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> |
|||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> |
|||
</component> |
|||
</project> |
|||
@ -1,6 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ProjectRootManager"> |
|||
<component name="ExternalStorageConfigurationManager" enabled="true" /> |
|||
<component name="MavenProjectsManager"> |
|||
<option name="originalFiles"> |
|||
<list> |
|||
<option value="$PROJECT_DIR$/pom.xml" /> |
|||
</list> |
|||
</option> |
|||
</component> |
|||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK"> |
|||
<output url="file://$PROJECT_DIR$/out" /> |
|||
</component> |
|||
</project> |
|||
@ -1,6 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="" vcs="Git" /> |
|||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" /> |
|||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,135 @@ |
|||
<?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"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>com.system</groupId> |
|||
<artifactId>test</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>17</maven.compiler.source> |
|||
<maven.compiler.target>17</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<system.version>1.1.1</system.version> |
|||
<spring.boot.version>3.4.4</spring.boot.version> |
|||
<mybatis.starter.version>3.0.5</mybatis.starter.version> |
|||
<mysql.version>8.3.0</mysql.version> |
|||
<lombok.version>1.18.38</lombok.version> |
|||
<slf4j.version>2.0.17</slf4j.version> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
<version>${spring.boot.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- AOP支持 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-aop</artifactId> |
|||
<version>${spring.boot.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/cglib/cglib --> |
|||
<dependency> |
|||
<groupId>cglib</groupId> |
|||
<artifactId>cglib</artifactId> |
|||
<version>3.3.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-aspects</artifactId> |
|||
<version>6.2.5</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter --> |
|||
<dependency> |
|||
<groupId>org.mybatis.spring.boot</groupId> |
|||
<artifactId>mybatis-spring-boot-starter</artifactId> |
|||
<version>${mybatis.starter.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j --> |
|||
<dependency> |
|||
<groupId>com.mysql</groupId> |
|||
<artifactId>mysql-connector-j</artifactId> |
|||
<version>${mysql.version}</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.slf4j</groupId> |
|||
<artifactId>slf4j-api</artifactId> |
|||
<version>${slf4j.version}</version> <!-- 版本号与项目中其他日志组件保持兼容 --> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<version>${lombok.version}</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>5.8.39</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>fastjson</artifactId> |
|||
<version>2.0.53</version> |
|||
</dependency> |
|||
|
|||
|
|||
<dependency> |
|||
<groupId>com.aliyun.oss</groupId> |
|||
<artifactId>aliyun-sdk-oss</artifactId> |
|||
<version>3.17.4</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-mail</artifactId> |
|||
<version>3.4.4</version> |
|||
</dependency> |
|||
|
|||
<!-- <dependency>--> |
|||
<!-- <groupId>org.springframework.boot</groupId>--> |
|||
<!-- <artifactId>spring-boot-starter-test</artifactId>--> |
|||
<!-- <version>3.4.4</version>--> |
|||
<!-- <scope>test</scope>--> |
|||
<!-- </dependency>--> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-cache</artifactId> |
|||
<version>3.4.4</version> |
|||
</dependency> |
|||
|
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
<version>3.4.4</version> |
|||
</dependency> |
|||
<!-- 在dependencies节点中添加 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-jdbc</artifactId> |
|||
<version>${spring.boot.version}</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.microsoft.sqlserver</groupId> |
|||
<artifactId>mssql-jdbc</artifactId> |
|||
<version>11.2.1.jre8</version> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
</project> |
|||
@ -0,0 +1,18 @@ |
|||
package com.link; |
|||
|
|||
import org.mybatis.spring.annotation.MapperScan; |
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
|
|||
@SpringBootApplication |
|||
@MapperScan(basePackages = "com.link.mapper", sqlSessionTemplateRef = "hljwSqlSessionTemplate") |
|||
@MapperScan(basePackages = "com.link.mapperwechart", sqlSessionTemplateRef = "wechartSqlSessionTemplate") |
|||
public class TestApplication { |
|||
|
|||
|
|||
public static void main(String[] args) { |
|||
|
|||
System.setProperty("https.protocols", "TLSv1,TLSv1.2,TLSv1.3"); |
|||
SpringApplication.run(TestApplication.class, args); |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package com.link.config; |
|||
|
|||
|
|||
import com.zaxxer.hikari.HikariDataSource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.mybatis.spring.SqlSessionFactoryBean; |
|||
import org.mybatis.spring.SqlSessionTemplate; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.boot.jdbc.DataSourceBuilder; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
@Slf4j |
|||
@Configuration |
|||
public class HljwDataSourceConfig { |
|||
|
|||
@Bean(name = "hljwDataSource") |
|||
@Primary |
|||
@ConfigurationProperties(prefix = "spring.datasource.hljw") |
|||
public DataSource hljwDataSource(){ |
|||
HikariDataSource dataSource = DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|||
log.info("hljw DataSource initialized with pool-name: {}", dataSource.getPoolName()); |
|||
return dataSource; |
|||
} |
|||
|
|||
@Bean(name = "hljwSqlSessionFactory") |
|||
@Primary |
|||
public SqlSessionFactory hljwSqlSessionFactory(@Qualifier("hljwDataSource") DataSource dataSource) throws Exception { |
|||
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
|||
sessionFactory.setDataSource(dataSource); |
|||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/link/mapper/*.xml")); |
|||
return sessionFactory.getObject(); |
|||
} |
|||
|
|||
@Bean(name = "hljwSqlSessionTemplate") |
|||
@Primary |
|||
public SqlSessionTemplate hljwSqlSessionTemplate(@Qualifier("hljwSqlSessionFactory") SqlSessionFactory sqlSessionFactory) { |
|||
return new SqlSessionTemplate(sqlSessionFactory); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package com.link.config; |
|||
|
|||
|
|||
import com.zaxxer.hikari.HikariDataSource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.mybatis.spring.SqlSessionFactoryBean; |
|||
import org.mybatis.spring.SqlSessionTemplate; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.boot.jdbc.DataSourceBuilder; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|||
|
|||
import javax.sql.DataSource; |
|||
|
|||
@Slf4j |
|||
@Configuration |
|||
public class WechartDataSourceConfig { |
|||
|
|||
@Bean(name = "wechartDataSource") |
|||
@ConfigurationProperties(prefix = "spring.datasource.wechart") |
|||
public DataSource wechartDataSource(){ |
|||
HikariDataSource dataSource = DataSourceBuilder.create().type(HikariDataSource.class).build(); |
|||
log.info("wechart DataSource initialized with pool-name: {}", dataSource.getPoolName()); |
|||
return dataSource; |
|||
} |
|||
|
|||
@Bean(name = "wechartSqlSessionFactory") |
|||
public SqlSessionFactory wechartSqlSessionFactory(@Qualifier("wechartDataSource") DataSource dataSource) throws Exception { |
|||
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
|||
sessionFactory.setDataSource(dataSource); |
|||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/link/mapperwechart/*.xml")); |
|||
return sessionFactory.getObject(); |
|||
} |
|||
|
|||
@Bean(name = "wechartSqlSessionTemplate") |
|||
public SqlSessionTemplate wechartSqlSessionTemplate(@Qualifier("wechartSqlSessionFactory") SqlSessionFactory sqlSessionFactory) { |
|||
return new SqlSessionTemplate(sqlSessionFactory); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.link.controller; |
|||
|
|||
|
|||
import com.link.domain.Result; |
|||
import com.link.domain.dto.AnchorUserTypeStatDTO; |
|||
import com.link.service.AnchorUserTypeStatService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/toAnchorUserTypeStat") |
|||
public class AnchorUserTypeStatController { |
|||
|
|||
@Autowired |
|||
private AnchorUserTypeStatService anchorUserTypeStatService; |
|||
|
|||
@PostMapping("/getDetails") |
|||
public Result getDetails(@RequestBody AnchorUserTypeStatDTO dto) { |
|||
Object result = anchorUserTypeStatService.getAnchorUserTypeStat(dto.getJwCodes(),dto.getStartTime()); |
|||
return Result.ok("success",result); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.link.controller; |
|||
|
|||
import com.link.domain.Result; |
|||
import com.link.domain.dto.CRMCountDTO; |
|||
import com.link.service.CRMCountService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@RequestMapping("/toCRM") |
|||
public class CRMCountController { |
|||
|
|||
@Autowired |
|||
private CRMCountService crmCountService; |
|||
|
|||
@PostMapping("/getCount") |
|||
public Result getCount(@RequestBody CRMCountDTO dto) { |
|||
Object result = crmCountService.getCRMCount(dto.getStartTime()); |
|||
return Result.ok("success",result); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.link.controller; |
|||
|
|||
|
|||
import com.link.domain.Result; |
|||
import com.link.domain.dto.NotRegisteredDTO; |
|||
import com.link.service.NotRegisteredService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/toNotRegistered") |
|||
public class NotRegisteredController { |
|||
@Autowired |
|||
private NotRegisteredService notRegisteredService; |
|||
|
|||
@PostMapping("/getjwCodes") |
|||
public Result getjwCodes(@RequestBody NotRegisteredDTO dto) { |
|||
Object result = notRegisteredService.getNotRegistered(dto.getJwCodes()); |
|||
System.out.println(result); |
|||
return Result.ok("success",result); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.link.controller; |
|||
|
|||
import com.link.domain.Result; |
|||
import com.link.domain.dto.UserCountDTO; |
|||
import com.link.service.UserCountService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/toUserCount") |
|||
public class UserCountController { |
|||
@Autowired |
|||
private UserCountService userCountService; |
|||
|
|||
@PostMapping("/toEmail") |
|||
public Result getEmailUserCount(@RequestBody UserCountDTO dto) { |
|||
Object result = userCountService.getEmailUserCount(dto.getStartTime()); |
|||
return Result.ok("success",result); |
|||
} |
|||
|
|||
@PostMapping("/toGoogle") |
|||
public Result getGoogleUserCount(@RequestBody UserCountDTO dto) { |
|||
Object result = userCountService.getGoogleUserCount(dto.getStartTime()); |
|||
return Result.ok("success",result); |
|||
} |
|||
|
|||
@PostMapping("/toMessage") |
|||
public Result getMessageUserCount(@RequestBody UserCountDTO dto) { |
|||
Object result = userCountService.getMessageUserCount(dto.getStartTime()); |
|||
return Result.ok("success",result); |
|||
} |
|||
} |
|||
@ -0,0 +1,108 @@ |
|||
package com.link.domain; |
|||
|
|||
// 请求是成功还是失败:ok error |
|||
// 后台希望前台弹出消息:msg |
|||
// 后台返回前台数据:Data |
|||
// JSON格式的通用响应对象,封装的就是后台返回给前台的所有信息 |
|||
public class Result { |
|||
public static final int ERROR = 1; |
|||
public static final int OK = 200; |
|||
|
|||
// 当前状态(程序员判断状态):成功、失败、未登录、没有权限 |
|||
private Integer code; |
|||
// 描述信息(主要是给用户看的提示信息) |
|||
private String msg; |
|||
// 后台返回给前端的数据 Object, User、List<User>、Map |
|||
private Object data; |
|||
// 新增:前端用于直接判断成功/失败的字段 |
|||
private boolean success; |
|||
|
|||
public Result() { |
|||
} |
|||
|
|||
public Result(Integer code) { |
|||
this.code = code; |
|||
this.success = code == OK; // 根据状态码自动设置success |
|||
} |
|||
|
|||
public Result(Integer code, String msg) { |
|||
this.code = code; |
|||
this.msg = msg; |
|||
this.success = code == OK; |
|||
} |
|||
|
|||
public Result(Integer code, Object data) { |
|||
this.code = code; |
|||
this.data = data; |
|||
this.success = code == OK; |
|||
} |
|||
|
|||
public Result(Integer code, String msg, Object data) { |
|||
this.code = code; |
|||
this.msg = msg; |
|||
this.data = data; |
|||
this.success = code == OK; |
|||
} |
|||
|
|||
// 告诉前台成功:code |
|||
public static Result ok() { |
|||
return new Result(OK); |
|||
} |
|||
|
|||
// 告诉前台成功:code、msg |
|||
public static Result ok(String msg) { |
|||
return new Result(OK, msg); |
|||
} |
|||
|
|||
// 告诉前台成功:code、data |
|||
public static Result ok(Object data) { |
|||
return new Result(OK, data); |
|||
} |
|||
|
|||
// 告诉前台成功:code、msg、data |
|||
public static Result ok(String msg, Object data) { |
|||
return new Result(OK, msg, data); |
|||
} |
|||
|
|||
|
|||
// 告诉前台失败:code |
|||
public static Result error() { |
|||
return new Result(ERROR); |
|||
} |
|||
|
|||
// 告诉前台失败:code、msg |
|||
public static Result error(String msg) { |
|||
return new Result(ERROR, msg); |
|||
} |
|||
|
|||
// Getter和Setter方法 |
|||
public Integer getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(Integer code) { |
|||
this.code = code; |
|||
this.success = code == OK; // 同步更新success状态 |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
public void setMsg(String msg) { |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public Object getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(Object data) { |
|||
this.data = data; |
|||
} |
|||
|
|||
// 添加success字段的Getter(不需要Setter,通过code自动维护) |
|||
public boolean isSuccess() { |
|||
return success; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.link.domain.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class AnchorUserTypeStatDTO { |
|||
|
|||
private List<String> jwCodes; |
|||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime startTime; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.link.domain.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class CRMCountDTO { |
|||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime startTime; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.link.domain.dto; |
|||
|
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class NotRegisteredDTO { |
|||
private List<String> jwCodes; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.link.domain.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UserCountDTO { |
|||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime startTime; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.link.domain.vo; |
|||
|
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class AnchorUserTypeStatVO { |
|||
|
|||
private String name; |
|||
private String userType; |
|||
private Integer userCount; |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package com.link.domain.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class CRMCountVO { |
|||
|
|||
private Integer userCount; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.link.domain.vo; |
|||
|
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class NotRegisteredVO { |
|||
private String jwcode; |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.link.domain.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class UserCountVO { |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private String businessDate; |
|||
// private LocalDateTime t1; |
|||
|
|||
private Integer userCount; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.link.mapper; |
|||
|
|||
import com.link.domain.vo.UserCountVO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
@Qualifier("hljwSqlSessionTemplate") |
|||
public interface UserCountMapper { |
|||
List<UserCountVO> getEmailUserCount(@Param("startTime") LocalDateTime startTime); |
|||
|
|||
List<UserCountVO> getGoogleUserCount(@Param("startTime") LocalDateTime startTime); |
|||
|
|||
List<UserCountVO> getMessageUserCount(@Param("startTime") LocalDateTime startTime); |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.link.mapperwechart; |
|||
|
|||
import com.link.domain.vo.AnchorUserTypeStatVO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
@Qualifier("wechartSqlSessionTemplate") |
|||
public interface AnchorUserTypeStatMapper { |
|||
List<AnchorUserTypeStatVO> getAnchorUserTypeStat(@Param("jwCodes") List<String> jwCodes, @Param("startTime") LocalDateTime startTime); |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package com.link.mapperwechart; |
|||
|
|||
import com.link.domain.vo.CRMCountVO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
@Mapper |
|||
@Qualifier("wechartSqlSessionTemplate") |
|||
public interface CRMCountMapper { |
|||
CRMCountVO getCRMCount(@Param("startTime") LocalDateTime startTime); |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.link.mapperwechart; |
|||
|
|||
|
|||
import com.link.domain.vo.NotRegisteredVO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
@Qualifier("wechartSqlSessionTemplate") |
|||
public interface NotRegisteredMapper { |
|||
List<NotRegisteredVO> getNotRegistered(@Param("jwCodes") List<String> jwCodes); |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
package com.link.service; |
|||
|
|||
import com.link.domain.vo.AnchorUserTypeStatVO; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
public interface AnchorUserTypeStatService { |
|||
|
|||
List<AnchorUserTypeStatVO> getAnchorUserTypeStat(List<String> jwCodes, LocalDateTime startTime); |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
package com.link.service; |
|||
|
|||
import com.link.domain.vo.CRMCountVO; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
|
|||
public interface CRMCountService { |
|||
|
|||
CRMCountVO getCRMCount(LocalDateTime startTime); |
|||
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
package com.link.service; |
|||
|
|||
import com.link.domain.vo.NotRegisteredVO; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface NotRegisteredService { |
|||
List<String> getNotRegistered(List<String> jwCodes); |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.link.service; |
|||
|
|||
import com.link.domain.vo.UserCountVO; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
public interface UserCountService { |
|||
|
|||
List<UserCountVO> getEmailUserCount(LocalDateTime startTime); |
|||
|
|||
List<UserCountVO> getGoogleUserCount(LocalDateTime startTime); |
|||
|
|||
List<UserCountVO> getMessageUserCount(LocalDateTime startTime); |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.link.serviceImpl; |
|||
|
|||
import com.link.domain.vo.AnchorUserTypeStatVO; |
|||
import com.link.mapperwechart.AnchorUserTypeStatMapper; |
|||
import com.link.service.AnchorUserTypeStatService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class AnchorUserTypeStatServiceImpl implements AnchorUserTypeStatService { |
|||
|
|||
@Autowired |
|||
private AnchorUserTypeStatMapper anchorUserTypeStatMapper; |
|||
|
|||
@Override |
|||
public List<AnchorUserTypeStatVO> getAnchorUserTypeStat(List<String> jwCodes, LocalDateTime startTime) { |
|||
return anchorUserTypeStatMapper.getAnchorUserTypeStat(jwCodes, startTime); |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.link.serviceImpl; |
|||
|
|||
import com.link.domain.vo.CRMCountVO; |
|||
|
|||
import com.link.mapperwechart.CRMCountMapper; |
|||
import com.link.service.CRMCountService; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.time.LocalDateTime; |
|||
|
|||
@Service |
|||
public class CRMCountServiceImpl implements CRMCountService { |
|||
|
|||
@Autowired |
|||
private CRMCountMapper crmCountMapper; |
|||
|
|||
@Override |
|||
public CRMCountVO getCRMCount(LocalDateTime startTime) { |
|||
return crmCountMapper.getCRMCount(startTime); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.link.serviceImpl; |
|||
|
|||
import com.link.domain.vo.NotRegisteredVO; |
|||
import com.link.mapperwechart.NotRegisteredMapper; |
|||
import com.link.service.NotRegisteredService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class NotRegisteredServiceImpl implements NotRegisteredService { |
|||
|
|||
@Autowired |
|||
private NotRegisteredMapper notRegisteredMapper; |
|||
@Override |
|||
public List<String> getNotRegistered(List<String> jwCodes) { |
|||
List<NotRegisteredVO> list = notRegisteredMapper.getNotRegistered(jwCodes); |
|||
List<String> jwcode = list.stream().map(NotRegisteredVO::getJwcode).toList(); |
|||
return jwcode; |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
package com.link.serviceImpl; |
|||
|
|||
import com.link.domain.vo.UserCountVO; |
|||
import com.link.mapper.UserCountMapper; |
|||
import com.link.service.UserCountService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class UserCountServiceImpl implements UserCountService { |
|||
|
|||
@Autowired |
|||
private UserCountMapper userCountMapper; |
|||
@Override |
|||
public List<UserCountVO> getEmailUserCount(LocalDateTime startTime) { |
|||
return userCountMapper.getEmailUserCount(startTime); |
|||
} |
|||
|
|||
@Override |
|||
public List<UserCountVO> getGoogleUserCount(LocalDateTime startTime) { |
|||
return userCountMapper.getGoogleUserCount(startTime); |
|||
} |
|||
|
|||
@Override |
|||
public List<UserCountVO> getMessageUserCount(LocalDateTime startTime) { |
|||
return userCountMapper.getMessageUserCount(startTime); |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
spring: |
|||
datasource: |
|||
hljw: |
|||
jdbc-url: jdbc:mysql://39.99.234.212:33061/hljw?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&connectTimeout=3000&socketTimeout=60000&autoReconnect=true&failOverReadOnly=false |
|||
username: 9008c85e-cb05-4eca-8321-c0443c1dc333 |
|||
password: m0tLJcB9f8rLquPr |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
hikari: |
|||
pool-name: hljwHikariCP |
|||
maximum-pool-size: 50 |
|||
|
|||
wechart: |
|||
jdbc-url: jdbc:sqlserver://18.142.225.183:1455;databaseName=wechart;loginTimeout=30;connectTimeout=30000;encrypt=true;enabledTLSProtocols=TLSv1.2;trustServerCertificate=true |
|||
username: query_hz |
|||
password: 8HxsYzefFBsLc8kksxa |
|||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
|||
hikari: |
|||
pool-name: wechartHikariCP |
|||
maximum-pool-size: 50 |
|||
|
|||
|
|||
|
|||
mybatis: |
|||
mapper-locations: classpath:mappers/*xml |
|||
type-aliases-package: com.link.domain |
|||
|
|||
logging: |
|||
level: |
|||
com.system.mapper: debug |
|||
|
|||
server: |
|||
port: 8080 |
|||
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.link.mapper.UserCountMapper"> |
|||
|
|||
<select id="getEmailUserCount" resultType="com.link.domain.vo.UserCountVO"> |
|||
select t1 as businessDate, count(*) as userCount |
|||
from ( |
|||
select distinct |
|||
case |
|||
when hh < 28800 then date_format(date_add(tt, interval -1 day), '%Y-%m-%d') |
|||
else date_format(tt, '%Y-%m-%d') |
|||
end as t1, |
|||
hh, |
|||
email, |
|||
tt |
|||
from ( |
|||
select |
|||
timestampdiff(second, date_format(tt, '%Y-%m-%d 00:00:00'), tt) as hh, |
|||
email, |
|||
tt |
|||
from ( |
|||
select distinct |
|||
email, |
|||
date_format(from_unixtime(`time`), '%Y-%m-%d %H:%i') as tt |
|||
from fx_email_code |
|||
where 1=1 |
|||
group by email |
|||
) a |
|||
) b |
|||
) c |
|||
where tt >= #{startTime} |
|||
group by t1; |
|||
</select> |
|||
|
|||
<select id="getGoogleUserCount" resultType="com.link.domain.vo.UserCountVO"> |
|||
select t1 as businessDate,count(*) as userCount from |
|||
(select distinct case when hh < 28800 then date_format(date_add(tt,interval -1 day),'%Y-%m-%d') else date_format(tt,'%Y-%m-%d') end t1,hh,openId,date_format(tt,'%Y-%m-%d %H:%i') tt from ( |
|||
select timestampdiff(second,date_format(tt,'%Y-%m-%d 00:00:00'),tt) hh,openId,tt from ( |
|||
select distinct openId,date_format(from_unixtime(time),'%Y-%m-%d %H:%i') tt,time from fx_member_google where 1=1 and time is not null |
|||
)a)b)c |
|||
where tt>= #{startTime} |
|||
group by t1; |
|||
</select> |
|||
|
|||
<select id="getMessageUserCount" resultType="com.link.domain.vo.UserCountVO"> |
|||
select t1 as businessDate,count(*) as userCount from |
|||
(select distinct case when hh < 28800 then date_format(date_add(tt,interval -1 day),'%Y-%m-%d') else date_format(tt,'%Y-%m-%d') end t1,hh,username,date_format(tt,'%Y-%m-%d %H:%i') tt from ( |
|||
select timestampdiff(second,date_format(tt,'%Y-%m-%d 00:00:00'),tt) hh,username,tt from ( |
|||
select username,min(date_format(from_unixtime(time),'%Y-%m-%d %H:%i')) tt from fx_code where 1=1 |
|||
group by username |
|||
)a)b)c |
|||
where tt>= #{startTime} |
|||
group by t1; |
|||
</select> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.link.mapperwechart.AnchorUserTypeStatMapper"> |
|||
|
|||
<select id="getAnchorUserTypeStat" resultType="com.link.domain.vo.AnchorUserTypeStatVO"> |
|||
WITH MinRegistrationDates AS ( |
|||
SELECT |
|||
jwcode, |
|||
MIN(DATEADD(SECOND, CAST(addTime AS INT), '1970-01-01 08:00:00')) AS EarliestRegistrationDate |
|||
FROM |
|||
newmedia_client |
|||
WHERE |
|||
jwcode IN |
|||
<foreach item="item" index="index" collection="jwCodes" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
GROUP BY |
|||
jwcode |
|||
), |
|||
UserClassification AS ( |
|||
SELECT |
|||
nc.jwcode, |
|||
nc.anchorMark, |
|||
DATEADD(SECOND, CAST(nc.addTime AS INT), '1970-01-01 08:00:00') AS registrationDate, |
|||
na.name, |
|||
CASE |
|||
WHEN DATEADD(SECOND, CAST(nc.addTime AS INT), '1970-01-01 08:00:00') < #{startTime} |
|||
THEN 'Old User' |
|||
ELSE 'New User' |
|||
END AS user_type |
|||
FROM |
|||
newmedia_client nc |
|||
LEFT JOIN |
|||
newMedia_anchor na ON nc.anchorMark = na.mark |
|||
JOIN |
|||
MinRegistrationDates mrd |
|||
ON nc.jwcode = mrd.jwcode |
|||
AND DATEADD(SECOND, CAST(nc.addTime AS INT), '1970-01-01 08:00:00') = mrd.EarliestRegistrationDate |
|||
) |
|||
SELECT |
|||
name, |
|||
user_type as userType, |
|||
COUNT(*) AS userCount |
|||
FROM |
|||
UserClassification |
|||
GROUP BY |
|||
name, user_type |
|||
ORDER BY |
|||
name, user_type; |
|||
</select> |
|||
</mapper> |
|||
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.link.mapperwechart.CRMCountMapper"> |
|||
|
|||
<select id="getCRMCount" resultType="com.link.domain.vo.CRMCountVO"> |
|||
SELECT COUNT(*) AS userCount |
|||
FROM newmedia_client |
|||
WHERE |
|||
CONVERT(DATE, DATEADD(SECOND, CAST(addTime AS BIGINT), '19700101')) = #{startTime}; |
|||
</select> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.link.mapperwechart.NotRegisteredMapper"> |
|||
|
|||
<select id="getNotRegistered" resultType="com.link.domain.vo.NotRegisteredVO"> |
|||
SELECT |
|||
jwcode |
|||
FROM |
|||
(VALUES |
|||
<foreach item="item" index="index" collection="jwCodes" separator=","> |
|||
(#{item}) |
|||
</foreach> |
|||
) AS jwcodes(jwcode) |
|||
WHERE |
|||
jwcode NOT IN ( |
|||
SELECT jwcode |
|||
FROM newmedia_client |
|||
WHERE |
|||
jwcode IN |
|||
<foreach item="item" index="index" collection="jwCodes" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
) |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue