功能:在保险、规则、交易、积分和短信模块中实现初始功能和基础组件。

This commit is contained in:
abcv7
2026-03-03 04:04:22 +08:00
parent e050eb3317
commit e156d625bf
1999 changed files with 146080 additions and 63 deletions
+110
View File
@@ -0,0 +1,110 @@
<?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>
<parent>
<groupId>com.itheima.sfbx</groupId>
<artifactId>sfbx-points</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>points-web</artifactId>
<version>2.0-SNAPSHOT</version>
<name>points-web</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-mybatis-plus</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-task-executor</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-redis</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-seata</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-knife4j-web</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>framework-influxdb</artifactId>
</dependency>
<dependency>
<groupId>com.itheima.sfbx</groupId>
<artifactId>insurance-interface</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
</dependencies>
<build>
<finalName>points-web</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,16 @@
package com.itheima.sfbx.points;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 数据采集埋点启动类(当前端登录、查看产品等时需要采集数据的话需要启动)
*/
@SpringBootApplication(scanBasePackages = {"com.itheima.sfbx","com.itheima.sfbx.points.mapper"})
public class PointsWebStart {
public static void main(String[] args) {
SpringApplication.run(PointsWebStart.class, args);
}
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日保险分类访问页面量缓存常量
*/
public class CategoryDpvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "category-dpv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:用户日活跃数缓存常量
*/
public class DauCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dau:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:用户日活跃数范围缓存常量
*/
public class DauRangeCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dau-range:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:用户活跃数时段缓存常量
*/
public class DauTimeCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dau-time:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日新增用户数缓存常量
*/
public class DnuCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dnu:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:新增用户所属城市缓存常量
*/
public class DnuCityCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dnu-city:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日投保分类明细缓存常量
*/
public class DoInsureCategoryCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-category:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:城市日投保用户访问数缓存常量
*/
public class DoInsureCityDuvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-city-duv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:投保转换率缓存常量
*/
public class DoInsureConversionDpvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-conversion-dpv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日投保明细缓存常量
*/
public class DoInsureDetailDayCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-detail-day:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日投保访问页面量缓存常量
*/
public class DoInsureDpvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-dpv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日投保用户访问数缓存常量
*/
public class DoInsureDuvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-duv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日投保访问失败页面量缓存常量
*/
public class DoInsureFailDpvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-fail-dpv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:性别日投保用户访问数缓存常量
*/
public class DoInsureGenderDuvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "do-insure-gender-duv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日访问页面量缓存常量
*/
public class DpvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "dpv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,26 @@
package com.itheima.sfbx.points.constant;
import com.itheima.sfbx.framework.commons.constant.basic.CacheConstant;
/**
* @Description:日唯一访问量缓存常量
*/
public class DuvCacheConstant extends CacheConstant {
//缓存父包
public static final String PREFIX= "duv:";
//缓存父包
public static final String BASIC= PREFIX+"basic";
//分布式锁前缀
public static final String LOCK_PREFIX = PREFIX+"lock:";
//page分页
public static final String PAGE= PREFIX+"page";
//list下拉框
public static final String LIST= PREFIX+"list";
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName CategoryDpvEnum.java
* @Description 日保险分类访问页面量枚举
*/
public enum CategoryDpvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日保险分类访问页面量分页失败"),
LIST_FAIL(53002, "查询日保险分类访问页面量列表失败"),
FIND_ONE_FAIL(53003, "查询日保险分类访问页面量对象失败"),
SAVE_FAIL(53004, "保存日保险分类访问页面量失败"),
UPDATE_FAIL(53005, "修改日保险分类访问页面量失败"),
DEL_FAIL(53006, "删除日保险分类访问页面量失败")
;
private Integer code;
private String msg;
CategoryDpvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DauEnum.java
* @Description 用户日活跃数枚举
*/
public enum DauEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询用户日活跃数分页失败"),
LIST_FAIL(53002, "查询用户日活跃数列表失败"),
FIND_ONE_FAIL(53003, "查询用户日活跃数对象失败"),
SAVE_FAIL(53004, "保存用户日活跃数失败"),
UPDATE_FAIL(53005, "修改用户日活跃数失败"),
DEL_FAIL(53006, "删除用户日活跃数失败")
;
private Integer code;
private String msg;
DauEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DauRangeEnum.java
* @Description 用户日活跃数范围枚举
*/
public enum DauRangeEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询用户日活跃数范围分页失败"),
LIST_FAIL(53002, "查询用户日活跃数范围列表失败"),
FIND_ONE_FAIL(53003, "查询用户日活跃数范围对象失败"),
SAVE_FAIL(53004, "保存用户日活跃数范围失败"),
UPDATE_FAIL(53005, "修改用户日活跃数范围失败"),
DEL_FAIL(53006, "删除用户日活跃数范围失败")
;
private Integer code;
private String msg;
DauRangeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DauTimeEnum.java
* @Description 用户活跃数时段枚举
*/
public enum DauTimeEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询用户活跃数时段分页失败"),
LIST_FAIL(53002, "查询用户活跃数时段列表失败"),
FIND_ONE_FAIL(53003, "查询用户活跃数时段对象失败"),
SAVE_FAIL(53004, "保存用户活跃数时段失败"),
UPDATE_FAIL(53005, "修改用户活跃数时段失败"),
DEL_FAIL(53006, "删除用户活跃数时段失败")
;
private Integer code;
private String msg;
DauTimeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DnuCityEnum.java
* @Description 新增用户所属城市枚举
*/
public enum DnuCityEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询新增用户所属城市分页失败"),
LIST_FAIL(53002, "查询新增用户所属城市列表失败"),
FIND_ONE_FAIL(53003, "查询新增用户所属城市对象失败"),
SAVE_FAIL(53004, "保存新增用户所属城市失败"),
UPDATE_FAIL(53005, "修改新增用户所属城市失败"),
DEL_FAIL(53006, "删除新增用户所属城市失败")
;
private Integer code;
private String msg;
DnuCityEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DnuEnum.java
* @Description 日新增用户数枚举
*/
public enum DnuEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日新增用户数分页失败"),
LIST_FAIL(53002, "查询日新增用户数列表失败"),
FIND_ONE_FAIL(53003, "查询日新增用户数对象失败"),
SAVE_FAIL(53004, "保存日新增用户数失败"),
UPDATE_FAIL(53005, "修改日新增用户数失败"),
DEL_FAIL(53006, "删除日新增用户数失败")
;
private Integer code;
private String msg;
DnuEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureCategoryEnum.java
* @Description 日投保分类明细枚举
*/
public enum DoInsureCategoryEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日投保分类明细分页失败"),
LIST_FAIL(53002, "查询日投保分类明细列表失败"),
FIND_ONE_FAIL(53003, "查询日投保分类明细对象失败"),
SAVE_FAIL(53004, "保存日投保分类明细失败"),
UPDATE_FAIL(53005, "修改日投保分类明细失败"),
DEL_FAIL(53006, "删除日投保分类明细失败")
;
private Integer code;
private String msg;
DoInsureCategoryEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureCityDuvEnum.java
* @Description 城市日投保用户访问数枚举
*/
public enum DoInsureCityDuvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询城市日投保用户访问数分页失败"),
LIST_FAIL(53002, "查询城市日投保用户访问数列表失败"),
FIND_ONE_FAIL(53003, "查询城市日投保用户访问数对象失败"),
SAVE_FAIL(53004, "保存城市日投保用户访问数失败"),
UPDATE_FAIL(53005, "修改城市日投保用户访问数失败"),
DEL_FAIL(53006, "删除城市日投保用户访问数失败")
;
private Integer code;
private String msg;
DoInsureCityDuvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureConversionDpvEnum.java
* @Description 投保转换率枚举
*/
public enum DoInsureConversionDpvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询投保转换率分页失败"),
LIST_FAIL(53002, "查询投保转换率列表失败"),
FIND_ONE_FAIL(53003, "查询投保转换率对象失败"),
SAVE_FAIL(53004, "保存投保转换率失败"),
UPDATE_FAIL(53005, "修改投保转换率失败"),
DEL_FAIL(53006, "删除投保转换率失败")
;
private Integer code;
private String msg;
DoInsureConversionDpvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureDetailDayEnum.java
* @Description 日投保明细枚举
*/
public enum DoInsureDetailDayEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日投保明细分页失败"),
LIST_FAIL(53002, "查询日投保明细列表失败"),
FIND_ONE_FAIL(53003, "查询日投保明细对象失败"),
SAVE_FAIL(53004, "保存日投保明细失败"),
UPDATE_FAIL(53005, "修改日投保明细失败"),
DEL_FAIL(53006, "删除日投保明细失败")
;
private Integer code;
private String msg;
DoInsureDetailDayEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureDpvEnum.java
* @Description 日投保访问页面量枚举
*/
public enum DoInsureDpvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日投保访问页面量分页失败"),
LIST_FAIL(53002, "查询日投保访问页面量列表失败"),
FIND_ONE_FAIL(53003, "查询日投保访问页面量对象失败"),
SAVE_FAIL(53004, "保存日投保访问页面量失败"),
UPDATE_FAIL(53005, "修改日投保访问页面量失败"),
DEL_FAIL(53006, "删除日投保访问页面量失败")
;
private Integer code;
private String msg;
DoInsureDpvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureDuvEnum.java
* @Description 日投保用户访问数枚举
*/
public enum DoInsureDuvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日投保用户访问数分页失败"),
LIST_FAIL(53002, "查询日投保用户访问数列表失败"),
FIND_ONE_FAIL(53003, "查询日投保用户访问数对象失败"),
SAVE_FAIL(53004, "保存日投保用户访问数失败"),
UPDATE_FAIL(53005, "修改日投保用户访问数失败"),
DEL_FAIL(53006, "删除日投保用户访问数失败")
;
private Integer code;
private String msg;
DoInsureDuvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureFailDpvEnum.java
* @Description 日投保访问失败页面量枚举
*/
public enum DoInsureFailDpvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日投保访问失败页面量分页失败"),
LIST_FAIL(53002, "查询日投保访问失败页面量列表失败"),
FIND_ONE_FAIL(53003, "查询日投保访问失败页面量对象失败"),
SAVE_FAIL(53004, "保存日投保访问失败页面量失败"),
UPDATE_FAIL(53005, "修改日投保访问失败页面量失败"),
DEL_FAIL(53006, "删除日投保访问失败页面量失败")
;
private Integer code;
private String msg;
DoInsureFailDpvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DoInsureGenderDuvEnum.java
* @Description 性别日投保用户访问数枚举
*/
public enum DoInsureGenderDuvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询性别日投保用户访问数分页失败"),
LIST_FAIL(53002, "查询性别日投保用户访问数列表失败"),
FIND_ONE_FAIL(53003, "查询性别日投保用户访问数对象失败"),
SAVE_FAIL(53004, "保存性别日投保用户访问数失败"),
UPDATE_FAIL(53005, "修改性别日投保用户访问数失败"),
DEL_FAIL(53006, "删除性别日投保用户访问数失败")
;
private Integer code;
private String msg;
DoInsureGenderDuvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DpvEnum.java
* @Description 日访问页面量枚举
*/
public enum DpvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日访问页面量分页失败"),
LIST_FAIL(53002, "查询日访问页面量列表失败"),
FIND_ONE_FAIL(53003, "查询日访问页面量对象失败"),
SAVE_FAIL(53004, "保存日访问页面量失败"),
UPDATE_FAIL(53005, "修改日访问页面量失败"),
DEL_FAIL(53006, "删除日访问页面量失败")
;
private Integer code;
private String msg;
DpvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.enums;
import com.itheima.sfbx.framework.commons.enums.basic.IBaseEnum;
/**
* @ClassName DuvEnum.java
* @Description 日唯一访问量枚举
*/
public enum DuvEnum implements IBaseEnum {
PAGE_FAIL(53001, "查询日唯一访问量分页失败"),
LIST_FAIL(53002, "查询日唯一访问量列表失败"),
FIND_ONE_FAIL(53003, "查询日唯一访问量对象失败"),
SAVE_FAIL(53004, "保存日唯一访问量失败"),
UPDATE_FAIL(53005, "修改日唯一访问量失败"),
DEL_FAIL(53006, "删除日唯一访问量失败")
;
private Integer code;
private String msg;
DuvEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
@@ -0,0 +1,38 @@
package com.itheima.sfbx.points.feign;
import com.itheima.sfbx.framework.commons.dto.log.LogBusinessVO;
import com.itheima.sfbx.framework.commons.utils.BeanConv;
import com.itheima.sfbx.points.pojo.BusinessLog;
import com.itheima.sfbx.points.service.IBusinessLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @ClassName BusinessReportFeignController.java
* @Description 业务统计
*/
@Slf4j
@Api(tags = "持久化:业务收集")
@RestController
@RequestMapping("business-log-feign")
public class BusinessLogFeignController {
@Autowired
IBusinessLogService businessLogService;
/**
* 持久化:日志信息
* @param logBusinessVO 日志对象
* @return 是否执行成功
*/
@PostMapping("create-business-log")
@ApiOperation(value = "日志信息", notes = "日志信息")
@ApiImplicitParam(name = "logBusinessVO", value = "日志对象", required = true, dataType = "LogBusinessVO")
public Boolean createBusinessLog(@RequestBody LogBusinessVO logBusinessVO) {
return businessLogService.createBusinessLog(BeanConv.toBean(logBusinessVO, BusinessLog.class));
}
}
@@ -0,0 +1,111 @@
package com.itheima.sfbx.points.feign;
import com.itheima.sfbx.points.service.IBusinessReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName BusinessReportFeignController.java
* @Description 业务统计
*/
@Slf4j
@Api(tags = "计划任务:业务统计")
@RestController
@RequestMapping("business-report-feign")
public class BusinessReportFeignController {
@Autowired
IBusinessReportService businessReportService;
/**
* 日投保访页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-dpv-job/{reportTime}")
@ApiOperation(value = "日投保访问页面量", notes = "日投保访问页面量")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureDpvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureDpvJob(reportTime);
}
/**
* 日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-duv-job/{reportTime}")
@ApiOperation(value = "日投保用户访问数", notes = "日投保用户访问数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureDuvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureDuvJob(reportTime);
}
/**
* 日保险分类访问页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("category-dpv-job/{reportTime}")
@ApiOperation(value = "日保险分类访问页面量", notes = "日保险分类访问页面量")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean categoryDpvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.categoryDpvJob(reportTime);
}
/**
* 性别日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-gender-duv-job/{reportTime}")
@ApiOperation(value = "性别日投保用户访问数", notes = "性别日投保用户访问数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureGenderDuvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureGenderDuvJob(reportTime);
}
/**
* 城市日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-city-duv-job/{reportTime}")
@ApiOperation(value = "城市日投保用户访问数", notes = "城市日投保用户访问数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureCityDuvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureCityDuvJob(reportTime);
}
/**
* 投保转换率
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-conversion-dpv-job/{reportTime}")
@ApiOperation(value = "投保转换率", notes = "投保转换率")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureConversionDpvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureConversionDpvJob(reportTime);
}
/**
* 日投保访问失败页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-fail-dpv-job/{reportTime}")
@ApiOperation(value = "日投保访问失败页面量", notes = "日投保访问失败页面量")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureFailDpvJob(@PathVariable("reportTime") String reportTime) {
return businessReportService.doInsureFailDpvJob(reportTime);
}
}
@@ -0,0 +1,111 @@
package com.itheima.sfbx.points.feign;
import com.itheima.sfbx.points.service.ICustomerReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName CustomerReportFeignController.java
* @Description 用户统计
*/
@Slf4j
@Api(tags = "计划任务:用户统计")
@RestController
@RequestMapping("customer-report-feign")
public class CustomerReportFeignController {
@Autowired
ICustomerReportService customerReportService;
/**
* 日新增用户数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dnu-job/{reportTime}")
@ApiOperation(value = "日新增用户数", notes = "日新增用户数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dnuJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dnuJob(reportTime);
}
/**
* 日新增注册用户归属城市
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dnu-city-job/{reportTime}")
@ApiOperation(value = "日新增注册用户归属城市", notes = "日新增注册用户归属城市")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dnuCityJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dnuCityJob(reportTime);
}
/**
* 用户日活跃数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dau-job/{reportTime}")
@ApiOperation(value = "用户日活跃数", notes = "用户日活跃数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dauJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dauJob(reportTime);
}
/**
* 用户每时活跃数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dau-time-job/{reportTime}")
@ApiOperation(value = "用户每时活跃数", notes = "用户每时活跃数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dauTimeJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dauTimeJob(reportTime);
}
/**
* 日访问量
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dpv-job/{reportTime}")
@ApiOperation(value = "日访问量", notes = "日访问量")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dpvJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dpvJob(reportTime);
}
/**
* 日用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("duv-job/{reportTime}")
@ApiOperation(value = "日用户访问数", notes = "日用户访问数")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean duvJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.duvJob(reportTime);
}
/**
* 用户日活跃数范围
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("dau-range-job/{reportTime}")
@ApiOperation(value = "用户日活跃数范围", notes = "用户日活跃数范围")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean dauRangeJob(@PathVariable("reportTime") String reportTime) {
return customerReportService.dauRangeJob(reportTime);
}
}
@@ -0,0 +1,52 @@
package com.itheima.sfbx.points.feign;
import com.itheima.sfbx.points.service.IBusinessReportService;
import com.itheima.sfbx.points.service.ISaleReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName SaleReportFeignController.java
* @Description 销售统计
*/
@Slf4j
@Api(tags = "计划任务:销售统计")
@RestController
@RequestMapping("sale-report-feign")
public class SaleReportFeignController {
@Autowired
ISaleReportService saleReportService;
/**
* 日投保额度明细
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("do-insure-details-day-job/{reportTime}")
@ApiOperation(value = "日投保额度明细", notes = "日投保额度明细")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureDetailsDayJob(@PathVariable("reportTime") String reportTime) {
return saleReportService.doInsureDetailDayJob(reportTime);
}
/**
* 日投保分类明细
* @param reportTime 统计时间
* @return 是否执行成功
*/
@PostMapping("doInsure-category-job/{reportTime}")
@ApiOperation(value = "日投保分类明细", notes = "日投保分类明细")
@ApiImplicitParam(name = "reportTime", value = "统计时间", required = true, dataType = "String")
public Boolean doInsureCategoryJob(@PathVariable("reportTime") String reportTime) {
return saleReportService.doInsureCategoryJob(reportTime);
}
}
@@ -0,0 +1,145 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.framework.influxdb.InfluxDBBaseMapper;
import com.itheima.sfbx.framework.influxdb.anno.Param;
import com.itheima.sfbx.framework.influxdb.anno.Select;
import com.itheima.sfbx.points.pojo.BusinessLog;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* BusinessLogMapper
*
* @describe: 数据埋点日志持久层(influxDB)
* @date: 2022/12/28 10:10
*/
@Mapper
public interface BusinessLogMapper extends InfluxDBBaseMapper {
/**
* 每日新注册用户
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT * FROM log WHERE response_code = '200' and time > #{begin} and time < #{end} and request_uri =~/register-user/",resultType = BusinessLog.class,database = "point_data")
List<BusinessLog> dnu(@Param("begin")String begin, @Param("end")String end);
/**
* 每日所有活跃用户userIds
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(DISTINCT(user_id)) as user_id FROM log WHERE time > #{begin} and time < #{end} ",resultType = String.class,database = "point_data")
List<String> allDauForUserId(@Param("begin")String begin, @Param("end")String end);
/**
* 每日新注册用户request_body
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT response_body FROM log WHERE response_code = '200' and time > #{begin} and time < #{end} and request_uri =~/register-user/",resultType = String.class,database = "point_data")
List<String> newDnuForResponseBody(@Param("begin")String begin, @Param("end")String end);
/**
* 日访问量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(request_id) FROM log WHERE time > #{begin} and time < #{end} ",resultType = Integer.class,database = "point_data")
Integer dpv(@Param("begin")String begin, @Param("end")String end);
/**
* 日用户访问量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(DISTINCT(user_id)) FROM log WHERE time > #{begin} and time < #{end} ",resultType = Integer.class,database = "point_data")
Integer duv(@Param("begin")String begin, @Param("end")String end);
/**
* 每日点击首页业务记录
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT * FROM log WHERE response_code = '200' and time > #{begin} and time < #{end} and request_uri =~/find-index-category-product/",resultType = BusinessLog.class,database = "point_data")
List<BusinessLog> dpvForIndex(@Param("begin")String begin, @Param("end")String end);
/**
* 日投保访问失败页面量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(request_id) FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/do-insure/ and response_code != 200 ",resultType = Integer.class,database = "point_data")
Integer doInsureFailDpv(@Param("begin")String begin, @Param("end")String end);
/**
* 日投保访问页面量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(request_id) FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/do-insure/",resultType = Integer.class,database = "point_data")
Integer doInsureDpv(@Param("begin")String begin, @Param("end")String end);
/**
* 日保险浏览页面量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(request_id) FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/.*find-insurance\\/.*/",resultType = Integer.class,database = "point_data")
Integer doBrowseDpv(@Param("begin")String begin, @Param("end")String end);
/**
* 日投保试算次数
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(request_id) FROM log WHERE time > #{begin} and time < #{end} and (request_uri =~/do-premium/ or request_uri =~/do-earnings/ )",resultType = Integer.class,database = "point_data")
Integer doTrialDpv(@Param("begin")String begin, @Param("end")String end);
/**
* 日投保用户访问数
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(DISTINCT(user_id)) FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/do-insure/",resultType = Integer.class,database = "point_data")
Integer doInsureDuv(@Param("begin")String begin, @Param("end")String end);
/**
* 日保险分类访问记录
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT response_body FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/.*find-insurance\\/.*/",resultType = String.class,database = "point_data")
List<String> categoryDpvForResponseBody(@Param("begin")String begin, @Param("end")String end);
/**
* 性别日投保访问页面量
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT COUNT(DISTINCT(user_id)) FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/do-insure/ and sex =#{sex}",resultType = Integer.class,database = "point_data")
Integer doInsureGenderDuv(@Param("begin")String begin, @Param("end")String end, @Param("sex")String sex);
/**
* 计划任务:城市日投保用户访问数
* @param begin
* @param end
* @return
*/
@Select(value = "SELECT * FROM log WHERE time > #{begin} and time < #{end} and request_uri =~/do-insure/ ",resultType = BusinessLog.class,database = "point_data")
List<BusinessLog> doInsureCityDuv(@Param("begin")String begin, @Param("end")String end);
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.CategoryDpv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日保险分类访问页面量Mapper接口
*/
@Mapper
public interface CategoryDpvMapper extends BaseMapper<CategoryDpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.Dau;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:用户日活跃数Mapper接口
*/
@Mapper
public interface DauMapper extends BaseMapper<Dau> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DauRange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:用户日活跃数范围Mapper接口
*/
@Mapper
public interface DauRangeMapper extends BaseMapper<DauRange> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DauTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:用户活跃数时段Mapper接口
*/
@Mapper
public interface DauTimeMapper extends BaseMapper<DauTime> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DnuCity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:新增用户所属城市Mapper接口
*/
@Mapper
public interface DnuCityMapper extends BaseMapper<DnuCity> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.Dnu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日新增用户数Mapper接口
*/
@Mapper
public interface DnuMapper extends BaseMapper<Dnu> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日投保分类明细Mapper接口
*/
@Mapper
public interface DoInsureCategoryMapper extends BaseMapper<DoInsureCategory> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureCityDuv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:城市日投保用户访问数Mapper接口
*/
@Mapper
public interface DoInsureCityDuvMapper extends BaseMapper<DoInsureCityDuv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureConversionDpv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:投保转换率Mapper接口
*/
@Mapper
public interface DoInsureConversionDpvMapper extends BaseMapper<DoInsureConversionDpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureDetailDay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日投保明细Mapper接口
*/
@Mapper
public interface DoInsureDetailDayMapper extends BaseMapper<DoInsureDetailDay> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureDpv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日投保访问页面量Mapper接口
*/
@Mapper
public interface DoInsureDpvMapper extends BaseMapper<DoInsureDpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureDuv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日投保用户访问数Mapper接口
*/
@Mapper
public interface DoInsureDuvMapper extends BaseMapper<DoInsureDuv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureFailDpv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日投保访问失败页面量Mapper接口
*/
@Mapper
public interface DoInsureFailDpvMapper extends BaseMapper<DoInsureFailDpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.DoInsureGenderDuv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:性别日投保用户访问数Mapper接口
*/
@Mapper
public interface DoInsureGenderDuvMapper extends BaseMapper<DoInsureGenderDuv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.Dpv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日访问页面量Mapper接口
*/
@Mapper
public interface DpvMapper extends BaseMapper<Dpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.mapper;
import com.itheima.sfbx.points.pojo.Duv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description:日唯一访问量Mapper接口
*/
@Mapper
public interface DuvMapper extends BaseMapper<Duv> {
}
@@ -0,0 +1,97 @@
package com.itheima.sfbx.points.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;
/**
* BusinessLog.java
* @describe: 数据埋点实体类--入库时间序列数据库
*/
@Data
@Measurement(database = "point_data", name = "log")
public class BusinessLog {
@ApiModelProperty(value = "请求id")
@Column(name = "request_id")
public String requestId;
@ApiModelProperty(value = "域名")
@Column(name = "host")
public String host;
@ApiModelProperty(value = "ip地址")
@Column(name = "host_address")
public String hostAddress;
@ApiModelProperty(value = "请求路径")
@Column(name = "request_uri", tag = true)
public String requestUri;
@ApiModelProperty(value = "请求方式")
@Column(name = "request_method", tag = true)
public String requestMethod;
@ApiModelProperty(value = "请求body")
@Column(name = "request_body")
public String requestBody;
@ApiModelProperty(value = "应答body")
@Column(name = "response_body")
public String responseBody;
@ApiModelProperty(value = "应答code")
@Column(name = "response_code", tag = true)
public String responseCode;
@ApiModelProperty(value = "应答msg")
@Column(name = "response_msg")
public String responseMsg;
@ApiModelProperty(value = "用户")
@Column(name = "user_id")
public String userId;
@ApiModelProperty(value = "用户名称")
@Column(name = "user_name")
public String userName;
@ApiModelProperty(value = "业务类型")
@Column(name = "business_type")
public String businessType;
@ApiModelProperty(value = "设备号")
@Column(name = "device_number")
public String deviceNumber;
@ApiModelProperty(value = "企业编号")
@Column(name = "company_no")
public String companyNO;
@ApiModelProperty(value = "性别")
@Column(name = "sex")
public String sex;
@ApiModelProperty(value = "修改时间")
@Column(name = "create_by")
public Long createBy;
@ApiModelProperty(value = "修改时间")
@Column(name = "update_by")
public Long updateBy;
@ApiModelProperty(value = "数据标志位")
@Column(name = "data_state", tag = true)
public String dataState ="0";
@ApiModelProperty(value = "")
@Column(name = "province")
public String province;
@ApiModelProperty(value = "")
@Column(name = "city")
public String city;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日保险分类访问页面量
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_category_dpv")
@ApiModel(value="CategoryDpv对象", description="日保险分类访问页面量")
public class CategoryDpv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public CategoryDpv(Long id, String dataState, Long categoryDpv, String categoryName, LocalDate reportTime){
super(id, dataState);
this.categoryDpv=categoryDpv;
this.categoryName=categoryName;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日保险分类访问页面量")
private Long categoryDpv;
@ApiModelProperty(value = "保险分类名称")
private String categoryName;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,61 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:用户日活跃数
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dau")
@ApiModel(value="Dau对象", description="用户日活跃数")
public class Dau extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public Dau(Long id,String dataState,Long allDau,Long newDau,Long oldDau,LocalDate reportTime){
super(id, dataState);
this.allDau=allDau;
this.newDau=newDau;
this.oldDau=oldDau;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "总用户活跃数")
private Long allDau;
@ApiModelProperty(value = "老用户活跃数")
private Long newDau;
@ApiModelProperty(value = "新用户活跃数")
private Long oldDau;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:用户日活跃数范围
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dau_range")
@ApiModel(value="DauRange对象", description="用户日活跃数范围")
public class DauRange extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DauRange(Long id, String dataState, String dauRang, Long userNum, LocalDate reportTime){
super(id, dataState);
this.dauRang=dauRang;
this.userNum=userNum;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "活跃数区间")
private String dauRang;
@ApiModelProperty(value = "用户数")
private Long userNum;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:用户活跃数时段
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dau_time")
@ApiModel(value="DauTime对象", description="用户活跃数时段")
public class DauTime extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DauTime(Long id,String dataState,Long dau,LocalDateTime reportTime){
super(id, dataState);
this.dau=dau;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "活跃用户数")
private Long dau;
@ApiModelProperty(value = "统计时间【精确到时分秒】")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")//set
private LocalDateTime reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日新增用户数
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dnu")
@ApiModel(value="Dnu对象", description="日新增用户数")
public class Dnu extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public Dnu(Long id,String dataState,Long dnu,LocalDate reportTime){
super(id, dataState);
this.dnu=dnu;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日新增用户数")
private Long dnu;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:新增用户所属城市
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dnu_city")
@ApiModel(value="DnuCity对象", description="新增用户所属城市")
public class DnuCity extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DnuCity(Long id,String dataState,Long dnu,String city,LocalDate reportTime){
super(id, dataState);
this.dnu=dnu;
this.city=city;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "新增用户数")
private Long dnu;
@ApiModelProperty(value = "")
private String city;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日投保分类明细
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_category")
@ApiModel(value="DoInsureCategory对象", description="日投保分类明细")
public class DoInsureCategory extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureCategory(Long id, String dataState, String categoryName, Long doInsureNums, LocalDate reportTime){
super(id, dataState);
this.categoryName=categoryName;
this.doInsureNums=doInsureNums;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "保险分类名称")
private String categoryName;
@ApiModelProperty(value = "投保次数")
private Long doInsureNums;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:城市日投保用户访问数
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_city_duv")
@ApiModel(value="DoInsureCityDuv对象", description="城市日投保用户访问数")
public class DoInsureCityDuv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureCityDuv(Long id,String dataState,String cityName,Long doInsureCityDuv,LocalDate reportTime){
super(id, dataState);
this.cityName=cityName;
this.doInsureCityDuv=doInsureCityDuv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "城市")
private String cityName;
@ApiModelProperty(value = "城市日投保唯一访问量")
private Long doInsureCityDuv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,59 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:投保转换率
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_conversion_dpv")
@ApiModel(value="DoInsureConversionDpv对象", description="投保转换率")
public class DoInsureConversionDpv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureConversionDpv(Long id, String dataState, Long doBrowseDpv, Long doTrialDpv, Long doInsureDpv, LocalDate reportTime){
super(id, dataState);
this.doBrowseDpv=doBrowseDpv;
this.doTrialDpv=doTrialDpv;
this.doInsureDpv=doInsureDpv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "投保浏览次数")
private Long doBrowseDpv;
@ApiModelProperty(value = "投保试算次数")
private Long doTrialDpv;
@ApiModelProperty(value = "投保提交次数")
private Long doInsureDpv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,68 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日投保明细
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_detail_day")
@ApiModel(value="DoInsureDetailDay对象", description="日投保明细")
public class DoInsureDetailDay extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureDetailDay(Long persons,Long id, String dataState, BigDecimal totalAmountDay, BigDecimal avgPieceAmountDay, BigDecimal avgPersonAmountDay, Long totalWarrantyDay, LocalDate reportTime) {
super(id, dataState);
this.totalAmountDay = totalAmountDay;
this.avgPieceAmountDay = avgPieceAmountDay;
this.avgPersonAmountDay = avgPersonAmountDay;
this.totalWarrantyDay = totalWarrantyDay;
this.persons = persons;
this.reportTime = reportTime;
}
@ApiModelProperty(value = "日投保总额度")
private BigDecimal totalAmountDay;
@ApiModelProperty(value = "日投保件均额度")
private BigDecimal avgPieceAmountDay;
@ApiModelProperty(value = "日投保人均额度")
private BigDecimal avgPersonAmountDay;
@ApiModelProperty(value = "日总合同数")
private Long totalWarrantyDay;
@ApiModelProperty(value = "投保人数")
private Long persons;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日投保访问页面量
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_dpv")
@ApiModel(value="DoInsureDpv对象", description="日投保访问页面量")
public class DoInsureDpv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureDpv(Long id,String dataState,Long doInsureDpv,LocalDate reportTime){
super(id, dataState);
this.doInsureDpv=doInsureDpv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日投保访问页面量")
private Long doInsureDpv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日投保用户访问数
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_duv")
@ApiModel(value="DoInsureDuv对象", description="日投保用户访问数")
public class DoInsureDuv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureDuv(Long id,String dataState,Long doInsureDuv,LocalDate reportTime){
super(id, dataState);
this.doInsureDuv=doInsureDuv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日投保唯一访问量")
private Long doInsureDuv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日投保访问失败页面量
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_fail_dpv")
@ApiModel(value="DoInsureFailDpv对象", description="日投保访问失败页面量")
public class DoInsureFailDpv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureFailDpv(Long id, String dataState, Long doInsureFailDpv, LocalDate reportTime){
super(id, dataState);
this.doInsureFailDpv=doInsureFailDpv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日投保访页失败面问量")
private Long doInsureFailDpv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,55 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:性别日投保用户访问数
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_do_insure_gender_duv")
@ApiModel(value="DoInsureGenderDuv对象", description="性别日投保用户访问数")
public class DoInsureGenderDuv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public DoInsureGenderDuv(Long id, String dataState, Long manDpv, Long womanDpv, LocalDate reportTime){
super(id, dataState);
this.manDpv=manDpv;
this.womanDpv=womanDpv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "男:日投保访页面问量")
private Long manDpv;
@ApiModelProperty(value = "女:日投保访页面问量")
private Long womanDpv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日访问页面量
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_dpv")
@ApiModel(value="Dpv对象", description="日访问页面量")
public class Dpv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public Dpv(Long id,String dataState,Long dpv,LocalDate reportTime){
super(id, dataState);
this.dpv=dpv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日访问页面量")
private Long dpv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,51 @@
package com.itheima.sfbx.points.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.itheima.sfbx.framework.mybatisplus.basic.BasePojo;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description:日唯一访问量
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("tab_duv")
@ApiModel(value="Duv对象", description="日唯一访问量")
public class Duv extends BasePojo {
private static final long serialVersionUID = 1L;
@Builder
public Duv(Long id,String dataState,Long duv,LocalDate reportTime){
super(id, dataState);
this.duv=duv;
this.reportTime=reportTime;
}
@ApiModelProperty(value = "日唯一访问量")
private Long duv;
@ApiModelProperty(value = "统计时间")
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate reportTime;
}
@@ -0,0 +1,17 @@
package com.itheima.sfbx.points.service;
import com.itheima.sfbx.points.pojo.BusinessLog;
/**
* @ClassName IBusinessLogService.java
* @Description 日志服务接口
*/
public interface IBusinessLogService {
/**
* 持久化日志信息
* @param businessLog 日志对象
* @return 是否执行成功
*/
Boolean createBusinessLog(BusinessLog businessLog);
}
@@ -0,0 +1,109 @@
package com.itheima.sfbx.points.service;
import com.itheima.sfbx.points.vo.analysis.DoInsureFailDpvVO;
import com.itheima.sfbx.points.vo.table.FunnelPlotChartsVO;
import com.itheima.sfbx.points.vo.table.StackingChartsVO;
/**
* @ClassName IBusinessReportService.java
* @Description 业务统计接口
*/
public interface IBusinessReportService {
/**
* 计划任务:日投保访问页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureDpvJob(String reportTime);
/**
* 计划任务:日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureDuvJob(String reportTime);
/**
* 计划任务:日保险分类访问页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean categoryDpvJob(String reportTime);
/**
* 计划任务:性别日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureGenderDuvJob(String reportTime);
/**
* 计划任务:城市日投保用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureCityDuvJob(String reportTime);
/**
* 计划任务:投保转换率
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureConversionDpvJob(String reportTime);
/**
* 计划任务:日投保访问失败页面量
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureFailDpvJob(String reportTime);
/**
* 数据展示:7日|点击立即投保用户数/次数
* @param startTime
* @param endTime
* @return
*/
StackingChartsVO doInsureDpvDuv(String startTime, String endTime);
/**
* 数据展示:7日|各险种点击率
* @param startTime
* @param endTime
* @return
*/
StackingChartsVO categoryDpv(String startTime, String endTime);
/**
* 数据展示:30日|投保用户性别分布
* @param startTime
* @param endTime
* @return
*/
StackingChartsVO doInsureGenderDuv(String startTime, String endTime);
/**
* 数据展示:30日|投保用户城市分布
* @param startTime
* @param endTime
* @return
*/
StackingChartsVO doInsureCityDuv(String startTime, String endTime);
/**
* 数据展示:投保流程转换漏斗
* @param startTime
* @param endTime
* @return
*/
FunnelPlotChartsVO doInsureConversionDpv(String startTime, String endTime);
/**
* 数据展示:30日|投保提交失败次数
* @param startTime 开始时间
* @param endTime 结束时间
* @return DauVO
*/
DoInsureFailDpvVO doInsureFailDpv(String startTime, String endTime);
}
@@ -0,0 +1,12 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.CategoryDpv;
/**
* @Description:日保险分类访问页面量服务类
*/
public interface ICategoryDpvService extends IService<CategoryDpv> {
}
@@ -0,0 +1,116 @@
package com.itheima.sfbx.points.service;
import com.itheima.sfbx.points.vo.analysis.DauTimeVO;
import com.itheima.sfbx.points.vo.analysis.DauVO;
import com.itheima.sfbx.points.vo.analysis.DnuVO;
import com.itheima.sfbx.points.vo.table.LineChartsVO;
import com.itheima.sfbx.points.vo.table.PiChartsVO;
import com.itheima.sfbx.points.vo.table.StackingChartsVO;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
/**
* @ClassName ICustomerReport.java
* @Description 用户统计接口
*/
public interface ICustomerReportService {
/**
* 计划任务:日新增用户数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dnuJob(String reportTime);
/**
* 计划任务:日新增注册用户归属城市
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dnuCityJob(String reportTime);
/**
* 计划任务:用户日活跃数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dauJob(String reportTime);
/**
* 计划任务:用户每时活跃数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dauTimeJob(String reportTime);
/**
* 计划任务:日访问量
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dpvJob(String reportTime);
/**
* 计划任务:日用户访问数
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean duvJob(String reportTime);
/**
* 计划任务:用户日活跃数范围
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean dauRangeJob(String reportTime);
/**
* 数据展示:日新增用户数
* @param startTime 开始时间
* @param endTime 结束时间
* @return DnuVO
*/
DnuVO dnu(String startTime,String endTime);
/**
* 数据展示:日新增用户所属城市
* @param startTime 开始时间
* @param endTime 结束时间
* @return DnuVO
*/
List<PiChartsVO> dnuCity(String startTime, String endTime);
/**
* 数据展示:30日|活跃用户数趋势
* @param startTime 开始时间
* @param endTime 结束时间
* @return DauVO
*/
DauVO dau(String startTime, String endTime);
/**
* 数据展示:30日|新老活跃用户结构
* @param startTime 开始时间
* @param endTime 结束时间
* @return DauVO
*/
StackingChartsVO newOldDau(String startTime, String endTime);
/**
* 数据展示:30日|每天活跃次数分布
* @param startTime 开始时间
* @param endTime 结束时间
* @return DauVO
*/
LineChartsVO dauRange(String startTime, String endTime);
/**
* 数据展示:7日|活跃时段分布
* @param startTime 开始时间
* @param endTime 结束时间
* @return DauVO
*/
DauTimeVO dauTime(String startTime, String endTime);
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DauRange;
/**
* @Description:用户日活跃数范围服务类
*/
public interface IDauRangeService extends IService<DauRange> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dau;
import com.itheima.sfbx.points.pojo.Dnu;
/**
* @Description:用户日活跃数
*/
public interface IDauService extends IService<Dau> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dau;
import com.itheima.sfbx.points.pojo.DauTime;
/**
* @Description:用户活跃数时段服务接口
*/
public interface IDauTimeService extends IService<DauTime> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dnu;
import com.itheima.sfbx.points.pojo.DnuCity;
/**
* @Description:新增用户所属城市服务类接口
*/
public interface IDnuCityService extends IService<DnuCity> {
}
@@ -0,0 +1,12 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dnu;
/**
* @Description:用户日活跃数服务类接口
*/
public interface IDnuService extends IService<Dnu> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureCategory;
/**
* @Description:日投保分类明细服务类
*/
public interface IDoInsureCategoryService extends IService<DoInsureCategory> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureCityDuv;
/**
* @Description:城市日投保用户访问数服务类
*/
public interface IDoInsureCityDuvService extends IService<DoInsureCityDuv> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureConversionDpv;
/**
* @Description:投保转换率服务类
*/
public interface IDoInsureConversionDpvService extends IService<DoInsureConversionDpv> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureDetailDay;
/**
* @Description:日投保明细服务类
*/
public interface IDoInsureDetailDayService extends IService<DoInsureDetailDay> {
}
@@ -0,0 +1,12 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureDpv;
/**
* @Description:日投保访问页面量服务类
*/
public interface IDoInsureDpvService extends IService<DoInsureDpv> {
}
@@ -0,0 +1,12 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureDuv;
/**
* @Description:日投保用户访问数服务类
*/
public interface IDoInsureDuvService extends IService<DoInsureDuv> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureFailDpv;
/**
* @Description:日投保访问失败页面量服务类
*/
public interface IDoInsureFailDpvService extends IService<DoInsureFailDpv> {
}
@@ -0,0 +1,11 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.DoInsureGenderDuv;
/**
* @Description:性别日投保用户访问数服务类
*/
public interface IDoInsureGenderDuvService extends IService<DoInsureGenderDuv> {
}
@@ -0,0 +1,12 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dpv;
/**
* @Description:日访问量服务类接口
*/
public interface IDpvService extends IService<Dpv> {
}
@@ -0,0 +1,13 @@
package com.itheima.sfbx.points.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.sfbx.points.pojo.Dpv;
import com.itheima.sfbx.points.pojo.Duv;
/**
* @Description:日用户访问数接口
*/
public interface IDuvService extends IService<Duv> {
}
@@ -0,0 +1,68 @@
package com.itheima.sfbx.points.service;
import com.itheima.sfbx.points.vo.analysis.AvgPersonAmountVO;
import com.itheima.sfbx.points.vo.analysis.CcnVO;
import com.itheima.sfbx.points.vo.analysis.SaleTopVO;
import com.itheima.sfbx.points.vo.analysis.WarrantyNumVO;
import com.itheima.sfbx.points.vo.table.StackingChartsVO;
/**
* @ClassName ISaleReportService.java
* @Description 日投保明细服务接口
*/
public interface ISaleReportService {
/**
* 计划任务:日投保额度明细
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureDetailDayJob(String reportTime);
/**
* 计划任务:日投保分类明细
* @param reportTime 统计时间
* @return 是否执行成功
*/
Boolean doInsureCategoryJob(String reportTime);
/**
* 数据展示:销售顶部统计
* @param startTime 开始时间
* @param endTime 结束时间
* @return SaleTopVO
*/
SaleTopVO saleTop(String startTime, String endTime);
/**
* 数据展示:累计保单客户数
* @param startTime 开始时间
* @param endTime 结束时间
* @return CcnVO
*/
CcnVO ccn(String startTime, String endTime);
/**
* 数据展示:7日|保单数
* @param startTime 开始时间
* @param endTime 结束时间
* @return WarrantyNumVO
*/
WarrantyNumVO warrantyNum(String startTime, String endTime);
/**
* 数据展示:7日|各分类投保保单
* @param startTime
* @param endTime
* @return StackingChartsVO
*/
StackingChartsVO doInsureCategory(String startTime, String endTime);
/**
* 数据展示:7日|人均保费
* @param startTime 开始时间
* @param endTime 结束时间
* @return WarrantyNumVO
*/
AvgPersonAmountVO avgPersonAmount(String startTime, String endTime);
}
@@ -0,0 +1,37 @@
package com.itheima.sfbx.points.service.impl;
import com.itheima.sfbx.framework.commons.enums.log.LogBusinessEnum;
import com.itheima.sfbx.framework.commons.exception.ProjectException;
import com.itheima.sfbx.framework.commons.utils.ExceptionsUtil;
import com.itheima.sfbx.points.mapper.BusinessLogMapper;
import com.itheima.sfbx.points.pojo.BusinessLog;
import com.itheima.sfbx.points.service.IBusinessLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
/**
* @ClassName BusinessLogServiceImple.java
* @Description 日志服务接口
*/
@Slf4j
@Service
public class BusinessLogServiceImple implements IBusinessLogService {
@Autowired
private BusinessLogMapper businessLogMapper;
@Override
public Boolean createBusinessLog(BusinessLog businessLog) {
try {
//插入到influxDB中
businessLogMapper.insertOne(businessLog);
return true;
} catch (Exception e) {
log.error("数据埋点日志插入异常:{}", ExceptionsUtil.getStackTraceAsString(e));
throw new ProjectException(LogBusinessEnum.SAVE_FAIL);
}
}
}
@@ -0,0 +1,618 @@
package com.itheima.sfbx.points.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.itheima.sfbx.framework.commons.constant.basic.SuperConstant;
import com.itheima.sfbx.framework.commons.dto.analysis.TimeDTO;
import com.itheima.sfbx.framework.commons.dto.report.CategoryReportVO;
import com.itheima.sfbx.framework.commons.dto.report.InsuranceReportVO;
import com.itheima.sfbx.framework.commons.utils.CityUtil;
import com.itheima.sfbx.framework.commons.utils.EmptyUtil;
import com.itheima.sfbx.framework.commons.utils.NoProcessing;
import com.itheima.sfbx.framework.commons.utils.TimeHandlerUtils;
import com.itheima.sfbx.instance.feign.CategoryFeign;
import com.itheima.sfbx.points.mapper.BusinessLogMapper;
import com.itheima.sfbx.points.pojo.*;
import com.itheima.sfbx.points.service.*;
import com.itheima.sfbx.points.vo.analysis.DoInsureFailDpvVO;
import com.itheima.sfbx.points.vo.analysis.DoInsureFailDpvVO;
import com.itheima.sfbx.points.vo.table.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @ClassName BusinessReportServiceImpl.java
* @Description 业务统计接口实现
*/
@Slf4j
@Service
public class BusinessReportServiceImpl implements IBusinessReportService {
@Autowired
BusinessLogMapper businessLogMapper;
@Autowired
IDoInsureDpvService doInsureDpvService;
@Autowired
IDoInsureDuvService doInsureDuvService;
@Autowired
IDoInsureGenderDuvService doInsureGenderDuvService;
@Autowired
IDoInsureCityDuvService doInsureCityDuvService;
@Autowired
IDoInsureConversionDpvService doInsureConversionDpvService;
@Autowired
IDoInsureFailDpvService doInsureFailDpvService;
@Autowired
ICategoryDpvService categoryDpvService;
@Autowired
CategoryFeign categoryFeign;
@Override
public Boolean doInsureDpvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureDpv::getReportTime,targetTime.getTargetDate());
DoInsureDpv doInsureDpv = doInsureDpvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(doInsureDpv)){
doInsureDpvService.remove(queryWrapper);
}
//统计日投保访问页面量
Integer doInsureDpvNums = businessLogMapper.doInsureDpv(targetTime.getBegin(), targetTime.getEnd());
doInsureDpvService.save(DoInsureDpv.builder()
.reportTime(targetTime.getTargetDate())
.doInsureDpv(Long.valueOf(doInsureDpvNums))
.build());
return true;
}
@Override
public Boolean doInsureDuvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureDuv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureDuv::getReportTime,targetTime.getTargetDate());
DoInsureDuv doInsureDuv = doInsureDuvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(doInsureDuv)){
doInsureDuvService.remove(queryWrapper);
}
//统计日投保用户访问数
Integer doInsureDuvNums = businessLogMapper.doInsureDuv(targetTime.getBegin(), targetTime.getEnd());
doInsureDuvService.save(DoInsureDuv.builder()
.reportTime(targetTime.getTargetDate())
.doInsureDuv(Long.valueOf(doInsureDuvNums))
.build());
return true;
}
@Override
public Boolean categoryDpvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<CategoryDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CategoryDpv::getReportTime,targetTime.getTargetDate());
List<CategoryDpv> categoryDpvs = categoryDpvService.list(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(categoryDpvs)){
categoryDpvService.remove(queryWrapper);
}
//统计日保险分类访问记录
List<String> categoryDpvBusinessLog = businessLogMapper
.categoryDpvForResponseBody(targetTime.getBegin(), targetTime.getEnd());
//无数据直接返回空
if (EmptyUtil.isNullOrEmpty(categoryDpvBusinessLog)){
return true;
}
List<InsuranceReportVO> insuranceReportVOs = Lists.newArrayList();
categoryDpvBusinessLog.forEach(n->{
insuranceReportVOs.add(JSONObject.parseObject(n, InsuranceReportVO.class));
});
//获得所有二级分类
List<CategoryReportVO> categoryReportVOs = categoryFeign
.categoryList(CategoryReportVO.builder().nodeFloors(Lists.newArrayList(2L)).build());
//无分类直接返回空
if (EmptyUtil.isNullOrEmpty(categoryReportVOs)){
return true;
}
//补全分类名称
insuranceReportVOs.forEach(n->{
categoryReportVOs.forEach(k->{
if (NoProcessing.isParent(k.getCategoryNo(),String.valueOf(n.getCategoryNo()))){
n.setCategoryName(k.getCategoryName());
}
});
});
//按保险分类名称进行分组
Map<String, List<InsuranceReportVO>> mapHandler = insuranceReportVOs.stream()
.collect(Collectors.groupingBy(InsuranceReportVO::getCategoryName));
List<CategoryDpv> categoryDpvList = Lists.newArrayList();
for (Map.Entry<String, List<InsuranceReportVO>> entry : mapHandler.entrySet()) {
categoryDpvList.add(CategoryDpv.builder().categoryDpv(Long.valueOf(entry.getValue().size()))
.categoryName(entry.getKey())
.reportTime(targetTime.getTargetDate())
.build());
}
categoryDpvService.saveBatch(categoryDpvList);
return true;
}
@Override
public Boolean doInsureGenderDuvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureGenderDuv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureGenderDuv::getReportTime,targetTime.getTargetDate());
DoInsureGenderDuv doInsureGenderDuv = doInsureGenderDuvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(doInsureGenderDuv)){
doInsureGenderDuvService.remove(queryWrapper);
}
//统计男性日投保用户访问数
Integer manDpv = businessLogMapper.doInsureGenderDuv(targetTime.getBegin(), targetTime.getEnd(), SuperConstant.MAN);
//统计女性日投保用户访问数
Integer womanDuv = businessLogMapper.doInsureGenderDuv(targetTime.getBegin(), targetTime.getEnd(), SuperConstant.WOMAN);
doInsureGenderDuvService.save(DoInsureGenderDuv.builder().manDpv(Long.valueOf(manDpv))
.womanDpv(Long.valueOf(womanDuv))
.reportTime(targetTime.getTargetDate())
.build());
return true;
}
@Override
public Boolean doInsureCityDuvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureCityDuv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureCityDuv::getReportTime,targetTime.getTargetDate());
List<DoInsureCityDuv> list = doInsureCityDuvService.list(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(list)){
doInsureCityDuvService.remove(queryWrapper);
}
//统计城市日投保用户访问数
List<BusinessLog> businessLogList= businessLogMapper.doInsureCityDuv(targetTime.getBegin(), targetTime.getEnd());
//统计结果为空则不处理
if (EmptyUtil.isNullOrEmpty(businessLogList)){
return true;
}
//按照用户id分组,然后循环取第一条【去重】
Map<String, List<BusinessLog>> mapUserIdHandler = businessLogList.stream().collect(
Collectors.groupingBy(BusinessLog::getUserId));
List<BusinessLog> listHandler = Lists.newArrayList();
for (Map.Entry<String, List<BusinessLog>> entry : mapUserIdHandler.entrySet()) {
listHandler.add(entry.getValue().get(0));
}
//按照城市名称分组
Map<String, List<BusinessLog>> mapCityHandler = listHandler.stream().collect(Collectors.groupingBy(BusinessLog::getCity));
List<DoInsureCityDuv> doInsureCityDuvs = Lists.newArrayList();
//保存城市日投保用户访问数
for (Map.Entry<String,List<BusinessLog>> entry : mapCityHandler.entrySet()) {
doInsureCityDuvs.add(DoInsureCityDuv.builder()
.cityName(entry.getKey())
.doInsureCityDuv(Long.valueOf(entry.getValue().size()))
.reportTime(targetTime.getTargetDate())
.build());
}
doInsureCityDuvService.saveBatch(doInsureCityDuvs);
return true;
}
@Override
public Boolean doInsureConversionDpvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureConversionDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureConversionDpv::getReportTime,targetTime.getTargetDate());
DoInsureConversionDpv doInsureConversionDpv = doInsureConversionDpvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(doInsureConversionDpv)){
doInsureConversionDpvService.remove(queryWrapper);
}
//投保浏览次数
Integer doBrowseDpv = businessLogMapper.doBrowseDpv(targetTime.getBegin(), targetTime.getEnd());
//投保试算次数
Integer doTrialDpv = businessLogMapper.doTrialDpv(targetTime.getBegin(), targetTime.getEnd());
//投保提交次数
Integer doInsureDpv = businessLogMapper.doInsureDpv(targetTime.getBegin(), targetTime.getEnd());
doInsureConversionDpvService.save(
DoInsureConversionDpv.builder()
.doBrowseDpv(Long.valueOf(doBrowseDpv))
.doTrialDpv(Long.valueOf(doTrialDpv))
.doInsureDpv(Long.valueOf(doInsureDpv))
.reportTime(targetTime.getTargetDate())
.build()
);
return true;
}
@Override
public Boolean doInsureFailDpvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DoInsureFailDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DoInsureFailDpv::getReportTime,targetTime.getTargetDate());
DoInsureFailDpv doInsureFailDpv = doInsureFailDpvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(doInsureFailDpv)){
doInsureFailDpvService.remove(queryWrapper);
}
//日投保提交失败页面量
Integer doInsureFailDpvs = businessLogMapper.doInsureFailDpv(targetTime.getBegin(), targetTime.getEnd());
doInsureFailDpvService.save(DoInsureFailDpv.builder()
.doInsureFailDpv(Long.valueOf(doInsureFailDpvs))
.reportTime(targetTime.getTargetDate())
.build());
return true;
}
@Override
public StackingChartsVO doInsureDpvDuv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new StackingChartsVO();
}
//查询时间范围数据
QueryWrapper<DoInsureDpv> queryWrapperDpv = new QueryWrapper<>();
queryWrapperDpv.lambda().between(DoInsureDpv::getReportTime,startTime,endTime);
List<DoInsureDpv> dauRangesDpvs = doInsureDpvService.list(queryWrapperDpv);
QueryWrapper<DoInsureDuv> queryWrapperDuv = new QueryWrapper<>();
queryWrapperDuv.lambda().between(DoInsureDuv::getReportTime,startTime,endTime);
List<DoInsureDuv> dauRangesDuvs = doInsureDuvService.list(queryWrapperDuv);
if (EmptyUtil.isNullOrEmpty(dauRangesDpvs)&&EmptyUtil.isNullOrEmpty(dauRangesDuvs)){
return new StackingChartsVO();
}
//X轴
List<String> dateRanges = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//Y轴:点击立即投保次数
List<Long> valueDataDoInsureDpv = dateRanges.stream()
.map(date -> {
return dauRangesDpvs.stream()
.filter(dto -> date.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.mapToLong(DoInsureDpv::getDoInsureDpv).sum();
}).collect(Collectors.toList());
StackingIndexVO stackingIndexVODoInsureDpv = new StackingIndexVO();
stackingIndexVODoInsureDpv.setName("投保 点击立即投保的总次数");
stackingIndexVODoInsureDpv.setData(valueDataDoInsureDpv);
//Y轴:点击立即投保用户数
List<Long> valueDataDoInsureDuv = dateRanges.stream()
.map(date -> {
return dauRangesDuvs.stream()
.filter(dto -> date.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.mapToLong(DoInsureDuv::getDoInsureDuv).sum();
}).collect(Collectors.toList());
StackingIndexVO stackingIndexVODoInsureDuv = new StackingIndexVO();
stackingIndexVODoInsureDuv.setName("投保 点击立即投保的用户数");
stackingIndexVODoInsureDuv.setData(valueDataDoInsureDuv);
//构建元素对象
List<StackingIndexVO> stackingIndexVOs = new ArrayList<StackingIndexVO>();
stackingIndexVOs.add(stackingIndexVODoInsureDpv);
stackingIndexVOs.add(stackingIndexVODoInsureDuv);
//返回最终结果
return StackingChartsVO.builder()
.label(dateRanges)
.value(stackingIndexVOs)
.build();
}
@Override
public StackingChartsVO categoryDpv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new StackingChartsVO();
}
//查询时间范围数据
QueryWrapper<CategoryDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(CategoryDpv::getReportTime,startTime,endTime);
List<CategoryDpv> categoryDpvs = categoryDpvService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(categoryDpvs)){
return new StackingChartsVO();
}
//X轴
List<String> dateRanges = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//按照分类进行分组
Map<String, List<CategoryDpv>> categoryDpvMapByCategoryName = categoryDpvs.stream().collect(Collectors.groupingBy(CategoryDpv::getCategoryName));
//构建饼状图
List<StackingIndexVO> stackingIndexVOs = Lists.newArrayList();
//分类名称
Set<String> categoryNames = categoryDpvMapByCategoryName.keySet();
categoryNames.forEach(n->{
StackingIndexVO stackingIndexVO = StackingIndexVO.builder().name(n).build();
List<CategoryDpv> categoryDpvsHandler = categoryDpvMapByCategoryName.get(n);
List<Long> data = Lists.newArrayList();
dateRanges.forEach(d->{
CategoryDpv categoryDpv = categoryDpvsHandler.stream()
.filter(dto -> d.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst()
.orElse(null);
if (!EmptyUtil.isNullOrEmpty(categoryDpv)){
data.add(categoryDpv.getCategoryDpv());
}else {
data.add(0L);
}
});
stackingIndexVO.setData(data);
stackingIndexVOs.add(stackingIndexVO);
});
return new StackingChartsVO(dateRanges,stackingIndexVOs);
}
@Override
public StackingChartsVO doInsureGenderDuv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new StackingChartsVO();
}
//查询时间范围数据
QueryWrapper<DoInsureGenderDuv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DoInsureGenderDuv::getReportTime,startTime,endTime).orderByAsc(DoInsureGenderDuv::getReportTime);
List<DoInsureGenderDuv> doInsureGenderDuvs = doInsureGenderDuvService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(doInsureGenderDuvs)){
return new StackingChartsVO();
}
//X轴
List<String> dateRanges = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//y轴
List<StackingIndexVO> value = Lists.newArrayList();
StackingIndexVO manStackingIndexVO = StackingIndexVO.builder().name("").build();
StackingIndexVO womanStackingIndexVO = StackingIndexVO.builder().name("").build();
List<Long> manData = Lists.newArrayList();
List<Long> womanData = Lists.newArrayList();
dateRanges.forEach(d->{
DoInsureGenderDuv doInsureGenderDuv = doInsureGenderDuvs.stream()
.filter(dto -> d.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst()
.orElse(null);
if (!EmptyUtil.isNullOrEmpty(doInsureGenderDuv)){
manData.add(doInsureGenderDuv.getManDpv());
womanData.add(doInsureGenderDuv.getWomanDpv());
}else {
manData.add(0L);
womanData.add(0L);
}
});
manStackingIndexVO.setData(manData);
womanStackingIndexVO.setData(womanData);
value.add(manStackingIndexVO);
value.add(womanStackingIndexVO);
return new StackingChartsVO(dateRanges,value);
}
@Override
public StackingChartsVO doInsureCityDuv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new StackingChartsVO();
}
//查询时间范围数据
QueryWrapper<DoInsureCityDuv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DoInsureCityDuv::getReportTime,startTime,endTime).orderByAsc(DoInsureCityDuv::getReportTime);
List<DoInsureCityDuv> doInsureCityDuvs = doInsureCityDuvService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(doInsureCityDuvs)){
return new StackingChartsVO();
}
//X轴
List<String> dateRanges = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//y轴
List<StackingIndexVO> value = Lists.newArrayList();
//一线城市
StackingIndexVO firstTierCity = StackingIndexVO.builder().name("一线城市").build();
//二线城市
StackingIndexVO secondTierCity = StackingIndexVO.builder().name("二线城市").build();
//三、四线城市
StackingIndexVO otherTierCity = StackingIndexVO.builder().name("三、四线城市").build();
//元素数据
List<Long> firstTierCityData = Lists.newArrayList();
List<Long> secondTierCityData = Lists.newArrayList();
List<Long> otherTierCityData = Lists.newArrayList();
//构建数据
dateRanges.forEach(d->{
List<DoInsureCityDuv> doInsureCityDuvHandler = doInsureCityDuvs.stream()
.filter(dto -> d.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.toList());
//当前时间无注册城市
if (EmptyUtil.isNullOrEmpty(doInsureCityDuvHandler)){
firstTierCityData.add(0L);
secondTierCityData.add(0L);
otherTierCityData.add(0L);
//当前时间有注册城市,判断城市类型,并求和
}else {
Long firstTierCityCount = doInsureCityDuvHandler.stream()
.filter(dto->CityUtil.isFirstTierCity(dto.getCityName()))
.mapToLong(DoInsureCityDuv::getDoInsureCityDuv).sum();
Long secondTierCityDataCount = doInsureCityDuvHandler.stream()
.filter(dto->CityUtil.isSecondTierCity(dto.getCityName()))
.mapToLong(DoInsureCityDuv::getDoInsureCityDuv).sum();
Long otherTierCityDataCount = doInsureCityDuvHandler.stream()
.filter(dto->CityUtil.isOtherCity(dto.getCityName()))
.mapToLong(DoInsureCityDuv::getDoInsureCityDuv).sum();
firstTierCityData.add(firstTierCityCount);
secondTierCityData.add(secondTierCityDataCount);
otherTierCityData.add(otherTierCityDataCount);
}
});
//设置元素数据
firstTierCity.setData(firstTierCityData);
secondTierCity.setData(secondTierCityData);
otherTierCity.setData(otherTierCityData);
//报表对象
value.add(firstTierCity);
value.add(secondTierCity);
value.add(otherTierCity);
return new StackingChartsVO(dateRanges,value);
}
@Override
public FunnelPlotChartsVO doInsureConversionDpv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new FunnelPlotChartsVO();
}
//查询时间范围数据
QueryWrapper<DoInsureConversionDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DoInsureConversionDpv::getReportTime,startTime,endTime).orderByAsc(DoInsureConversionDpv::getReportTime);
List<DoInsureConversionDpv> doInsureConversionDpvs = doInsureConversionDpvService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(doInsureConversionDpvs)){
return new FunnelPlotChartsVO();
}
//X轴
FunnelPlotChartsVO funnelPlotChartsVO = new FunnelPlotChartsVO();
funnelPlotChartsVO.setLabel(Arrays.asList("投保浏览次数", "投保试算次数", "投保提交次数"));
//合计投保浏览次数
long sumDoBrowseDpv = doInsureConversionDpvs.stream().mapToLong(DoInsureConversionDpv::getDoBrowseDpv).sum();
FunnelPlotChartsIndexVO sumDoBrowseDpvIndexVO = FunnelPlotChartsIndexVO.builder()
.name("投保浏览次数").value(sumDoBrowseDpv).build();
//合计投保试算次数
long sumDoTrialDpv = doInsureConversionDpvs.stream().mapToLong(DoInsureConversionDpv::getDoTrialDpv).sum();
FunnelPlotChartsIndexVO sumDoTrialDpvIndexVO = FunnelPlotChartsIndexVO.builder()
.name("投保试算次数").value(sumDoTrialDpv).build();
//合计投保提交次数
long sumDoInsureDpv = doInsureConversionDpvs.stream().mapToLong(DoInsureConversionDpv::getDoInsureDpv).sum();
FunnelPlotChartsIndexVO sumDoInsureDpvIndexVO = FunnelPlotChartsIndexVO.builder()
.name("投保提交次数").value(sumDoInsureDpv).build();
List<FunnelPlotChartsIndexVO> value = new ArrayList<>();
value.add(sumDoBrowseDpvIndexVO);
value.add(sumDoTrialDpvIndexVO);
value.add(sumDoInsureDpvIndexVO);
funnelPlotChartsVO.setValue(value);
return funnelPlotChartsVO;
}
@Override
public DoInsureFailDpvVO doInsureFailDpv(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new DoInsureFailDpvVO();
}
//查询时间范围数据
QueryWrapper<DoInsureFailDpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DoInsureFailDpv::getReportTime,startTime,endTime).orderByAsc(DoInsureFailDpv::getReportTime);
List<DoInsureFailDpv> doInsureFailDpvs = doInsureFailDpvService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(doInsureFailDpvs)){
return new DoInsureFailDpvVO();
}
DoInsureFailDpvVO doInsureFailDpvVO = new DoInsureFailDpvVO();
//X轴
List<String> dateRange = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//Y轴
List<Long> valueData =doInsureFailDpvs.stream().map(DoInsureFailDpv::getDoInsureFailDpv).collect(Collectors.toList());
//折线表格数据
LineChartsVO lineChartsVO = new LineChartsVO();
lineChartsVO.setLabel(dateRange);
lineChartsVO.setValue(valueData);
doInsureFailDpvVO.setTable(lineChartsVO);
//合计
Long total = doInsureFailDpvs.stream().mapToLong(DoInsureFailDpv::getDoInsureFailDpv).sum();
doInsureFailDpvVO.setTotal(total);
//均值
LocalDate localDateStartTime = LocalDate.parse(startTime);
LocalDate localDateEndTime = LocalDate.parse(endTime);
doInsureFailDpvVO.setAverage(new BigDecimal(total).divide(new BigDecimal(localDateStartTime.until(localDateEndTime, ChronoUnit.DAYS)),2, RoundingMode.HALF_UP));
//环比上周=本日注册/7日前注册
DoInsureFailDpv doInsureFailDpvToday = doInsureFailDpvs.stream().filter(dto -> endTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
BigDecimal doInsureFailDpvTodayBigDecimal = BigDecimal.ZERO;
if (!EmptyUtil.isNullOrEmpty(doInsureFailDpvToday)){
doInsureFailDpvTodayBigDecimal = new BigDecimal(doInsureFailDpvToday.getDoInsureFailDpv());
}
String earlier7Time = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-7).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
DoInsureFailDpv doInsureFailDpvTodayEarlier7 = doInsureFailDpvs.stream().filter(dto -> earlier7Time.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(doInsureFailDpvTodayEarlier7)&&!doInsureFailDpvTodayEarlier7.getDoInsureFailDpv().equals(0L)) {
BigDecimal qoqLastWeek = doInsureFailDpvTodayBigDecimal
.divide(new BigDecimal(doInsureFailDpvTodayEarlier7.getDoInsureFailDpv()), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
doInsureFailDpvVO.setQoqLastWeek(qoqLastWeek);
}
//同比昨日=本日注册/昨日前注册
String yesterdayTime = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
DoInsureFailDpv doInsureFailDpvYesterday = doInsureFailDpvs.stream().filter(dto -> yesterdayTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(doInsureFailDpvYesterday)&&!doInsureFailDpvYesterday.getDoInsureFailDpv().equals(0L)) {
BigDecimal qoq = doInsureFailDpvTodayBigDecimal
.divide(new BigDecimal(doInsureFailDpvYesterday.getDoInsureFailDpv()), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
doInsureFailDpvVO.setQoq(qoq);
}
//当日总人数
Long perNums = doInsureFailDpvTodayBigDecimal.longValue();
doInsureFailDpvVO.setPerNums(perNums);
return doInsureFailDpvVO;
}
}
@@ -0,0 +1,16 @@
package com.itheima.sfbx.points.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sfbx.points.mapper.CategoryDpvMapper;
import com.itheima.sfbx.points.pojo.CategoryDpv;
import com.itheima.sfbx.points.service.ICategoryDpvService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description:日保险分类访问页面量服务实现类
*/
@Slf4j
@Service
public class CategoryDpvServiceImpl extends ServiceImpl<CategoryDpvMapper, CategoryDpv> implements ICategoryDpvService {
}
@@ -0,0 +1,681 @@
package com.itheima.sfbx.points.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.itheima.sfbx.framework.commons.dto.analysis.TimeDTO;
import com.itheima.sfbx.framework.commons.dto.security.UserVO;
import com.itheima.sfbx.framework.commons.utils.DateAvgUtil;
import com.itheima.sfbx.framework.commons.utils.EmptyUtil;
import com.itheima.sfbx.framework.commons.utils.TimeHandlerUtils;
import com.itheima.sfbx.points.mapper.BusinessLogMapper;
import com.itheima.sfbx.points.pojo.*;
import com.itheima.sfbx.points.service.*;
import com.itheima.sfbx.points.vo.analysis.DauTimeVO;
import com.itheima.sfbx.points.vo.analysis.DauVO;
import com.itheima.sfbx.points.vo.analysis.DnuVO;
import com.itheima.sfbx.points.vo.table.LineChartsVO;
import com.itheima.sfbx.points.vo.table.PiChartsVO;
import com.itheima.sfbx.points.vo.table.StackingChartsVO;
import com.itheima.sfbx.points.vo.table.StackingIndexVO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.StyledEditorKit;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @ClassName CustomerReportServiceImpl.java
* @Description 用户统计接口实现
*/
@Service
public class CustomerReportServiceImpl implements ICustomerReportService {
@Autowired
BusinessLogMapper businessLogMapper;
@Autowired
IDnuService dnuService;
@Autowired
IDnuCityService dnuCityService;
@Autowired
IDauService dauService;
@Autowired
IDauTimeService dauTimeService;
@Autowired
IDpvService dpvService;
@Autowired
IDuvService duvService;
@Autowired
IDauRangeService dauRangeService;
@Override
public Boolean dnuJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<Dnu> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Dnu::getReportTime,targetTime.getTargetDate());
Dnu dnu = dnuService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dnu)){
dnuService.remove(queryWrapper);
}
//从influxdb中统计当天所有注册用户
List<BusinessLog> dnuHandler = businessLogMapper.dnu(targetTime.getBegin(), targetTime.getEnd());
if (!EmptyUtil.isNullOrEmpty(dnuHandler)){
dnuService.save(Dnu.builder()
.reportTime(targetTime.getTargetDate())
.dnu(Long.valueOf(dnuHandler.size()))
.build());
}else {
dnuService.save(Dnu.builder()
.reportTime(targetTime.getTargetDate())
.dnu(0L)
.build());
}
return true;
}
@Override
public Boolean dnuCityJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DnuCity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DnuCity::getReportTime,targetTime.getTargetDate());
List<DnuCity> dnuCity = dnuCityService.list(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dnuCity)){
dnuCityService.remove(queryWrapper);
}
//从influxdb中统计当天所有注册用户
List<BusinessLog> dnuHandler = businessLogMapper.dnu(targetTime.getBegin(), targetTime.getEnd());
if (!EmptyUtil.isNullOrEmpty(dnuHandler)){
//进行分组处理
Map<String, List<BusinessLog>> mapHandler = dnuHandler.stream().collect(Collectors.groupingBy(BusinessLog::getCity));
List<DnuCity> list = Lists.newArrayList();
for (String key : mapHandler.keySet()) {
DnuCity dnuCityHandler = DnuCity.builder()
.city(key)
.dnu(Long.valueOf(mapHandler.get(key).size()))
.reportTime(targetTime.getTargetDate())
.build();
list.add(dnuCityHandler);
}
dnuCityService.saveBatch(list);
}
return true;
}
@Override
public Boolean dauJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<Dau> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Dau::getReportTime,targetTime.getTargetDate());
Dau dau = dauService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dau)){
dauService.remove(queryWrapper);
}
//统计当天所有活跃用户userIds
List<String> allDauForUserId = businessLogMapper.allDauForUserId(targetTime.getBegin(), targetTime.getEnd());
//所有活跃用户数
Integer allDau = allDauForUserId.size();
//统计当天所有注册用户
List<BusinessLog> dnu = businessLogMapper.dnu(targetTime.getBegin(), targetTime.getEnd());
//所有活跃新用户数
Integer newDau = dnu.size();
//所有活跃老用户数
Integer oldDau = allDau-newDau;
dauService.save(Dau.builder()
.allDau(Long.valueOf(allDau))
.newDau(Long.valueOf(newDau))
.oldDau(Long.valueOf(oldDau))
.reportTime(targetTime.getTargetDate())
.build());
return true;
}
@Override
public Boolean dauTimeJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
if (flag){
reportTime = LocalDate.parse(reportTime).plusDays(-1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
QueryWrapper<DauTime> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().likeRight(DauTime::getReportTime,reportTime);
List<DauTime> dauTimeList = dauTimeService.list(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dauTimeList)){
dauTimeService.remove(queryWrapper);
}
//目标日期24个时间段
List<TimeDTO> targetTimes = TimeHandlerUtils.getToday24Time(reportTime);
if (flag){
targetTimes = TimeHandlerUtils.getYesterday24Time(reportTime);
}
List<DauTime> dauTimes = Lists.newArrayList();
//分时段查询用户活跃数
for (TimeDTO timeDTO : targetTimes) {
List<String> allDauForUserId = businessLogMapper.allDauForUserId(timeDTO.getBegin(), timeDTO.getEnd());
dauTimes.add(DauTime.builder()
.dau(Long.valueOf(allDauForUserId.size()))
.reportTime(timeDTO.getTargetDateTime())
.build());
}
dauTimeService.saveBatch(dauTimes);
return true;
}
@Override
public Boolean dpvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<Dpv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Dpv::getReportTime,targetTime.getTargetDate());
Dpv dpv = dpvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dpv)){
dpvService.remove(queryWrapper);
}
//统计日访问量
Integer dpvNums = businessLogMapper.dpv(targetTime.getBegin(), targetTime.getEnd());
dpvService.save(Dpv.builder()
.dpv(Long.valueOf(dpvNums))
.reportTime(targetTime.getTargetDate())
.build());
return true;
}
@Override
public Boolean duvJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<Duv> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Duv::getReportTime,targetTime.getTargetDate());
Duv duv = duvService.getOne(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(duv)){
duvService.remove(queryWrapper);
}
//统计日访问量
Integer duvNums = businessLogMapper.duv(targetTime.getBegin(), targetTime.getEnd());
duvService.save(Duv.builder()
.duv(Long.valueOf(duvNums))
.reportTime(targetTime.getTargetDate())
.build());
return true;
}
@Override
public Boolean dauRangeJob(String reportTime) {
//判断报表时间是否指定,未指定则使用当前时间
if (EmptyUtil.isNullOrEmpty(reportTime)){
reportTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
//判断统计时间是否为00:00到06:00
boolean flag = TimeHandlerUtils.isTimeInRange();
//目标日期
TimeDTO targetTime = TimeHandlerUtils.getTodayTime(reportTime);
if (flag){
targetTime = TimeHandlerUtils.getYesterdayTime(reportTime);
}
QueryWrapper<DauRange> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DauRange::getReportTime,targetTime.getTargetDate());
List<DauRange> dauRanges = dauRangeService.list(queryWrapper);
if (!EmptyUtil.isNullOrEmpty(dauRanges)){
dauRangeService.remove(queryWrapper);
}
//统计每日点击首页业务记录
List<BusinessLog> dpvForIndex = businessLogMapper.dpvForIndex(targetTime.getBegin(), targetTime.getEnd());
//对每日点击首页业务记录按用户进行分组处理
Map<String, List<BusinessLog>> userRangMap = dpvForIndex.stream().collect(Collectors.groupingBy(BusinessLog::getUserId));
//创建分布范围
Map<String,Long> rangeMap = Maps.newLinkedHashMap();
rangeMap.put("1-5",0L);
rangeMap.put("5-10",0L);
rangeMap.put("10-20",0L);
rangeMap.put("20-40",0L);
rangeMap.put("40-80",0L);
rangeMap.put("80以上",0L);
for (Map.Entry<String,Long> range : rangeMap.entrySet()) {
List<String> rangeListHandler = Lists.newArrayList();
String[] Keys = range.getKey().split("-");
for (String key : Keys) {
rangeListHandler.add(key.replace("以上",""));
}
if (rangeListHandler.size()==2){
Long rangeStart = Long.valueOf(rangeListHandler.get(0));
Long rangeEnd = Long.valueOf(rangeListHandler.get(1));
for (Map.Entry<String, List<BusinessLog>> entry : userRangMap.entrySet()) {
Long userNum = Long.valueOf(entry.getValue().size());
if (rangeStart<=userNum&&userNum<rangeEnd){
long targetLong = range.getValue()+1L;
rangeMap.put(range.getKey(),targetLong);
}
}
}else {
Long rangeStart = Long.valueOf(rangeListHandler.get(0));
for (Map.Entry<String, List<BusinessLog>> entry : userRangMap.entrySet()) {
Long userNum = Long.valueOf(entry.getValue().size());
if (rangeStart<=userNum){
long targetLong = range.getValue()+1L;
rangeMap.put(range.getKey(),targetLong);
}
}
}
}
List<DauRange> dauRangesHandler = Lists.newArrayList();
for (Map.Entry<String,Long> range : rangeMap.entrySet()) {
dauRangesHandler.add(DauRange.builder()
.dauRang(range.getKey())
.userNum(range.getValue())
.reportTime(targetTime.getTargetDate())
.build());
}
dauRangeService.saveBatch(dauRangesHandler);
return true;
}
@Override
public DnuVO dnu(String startTime,String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new DnuVO();
}
//查询时间范围数据
QueryWrapper<Dnu> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(Dnu::getReportTime,startTime,endTime).orderByAsc(Dnu::getReportTime);
List<Dnu> dnus = dnuService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(dnus)){
return new DnuVO();
}
DnuVO dnuVO = new DnuVO();
//X轴
List<String> dateRange = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//Y轴
List<Long> valueData = dnus.stream().map(Dnu::getDnu).collect(Collectors.toList());
//折线表格数据
LineChartsVO lineChartsVO = new LineChartsVO();
lineChartsVO.setLabel(dateRange);
lineChartsVO.setValue(valueData);
dnuVO.setTable(lineChartsVO);
//合计
Long total = dnus.stream().mapToLong(Dnu::getDnu).sum();
dnuVO.setTotal(total);
//均值
LocalDate localDateStartTime = LocalDate.parse(startTime);
LocalDate localDateEndTime = LocalDate.parse(endTime);
dnuVO.setAverage(new BigDecimal(total).divide(new BigDecimal(localDateStartTime.until(localDateEndTime, ChronoUnit.DAYS)),2,RoundingMode.HALF_UP));
//环比上周=本日注册/7日前注册
Dnu dnuToday = dnus.stream().filter(dto -> endTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
BigDecimal dnuTodayBigDecimal = BigDecimal.ZERO;
if (!EmptyUtil.isNullOrEmpty(dnuToday)){
dnuTodayBigDecimal = new BigDecimal(dnuToday.getDnu());
}
String earlier7Time = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-7).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Dnu dnuEarlier7 = dnus.stream().filter(dto -> earlier7Time.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(dnuEarlier7)&&!dnuEarlier7.getDnu().equals(0L)){
BigDecimal qoqLastWeek =dnuTodayBigDecimal.divide(new BigDecimal(dnuEarlier7.getDnu()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
dnuVO.setQoqLastWeek(qoqLastWeek);
}
//同比昨日=本日注册/昨日前注册
String yesterdayTime = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Dnu dnuYesterday = dnus.stream().filter(dto -> yesterdayTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))).findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(dnuYesterday)&&!dnuYesterday.getDnu().equals(0L)) {
BigDecimal qoq = dnuTodayBigDecimal.divide(new BigDecimal(dnuYesterday.getDnu()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
dnuVO.setQoq(qoq);
}
//当日总注册人数
Long perNums = dnuTodayBigDecimal.longValue();
dnuVO.setPerNums(perNums);
return dnuVO;
}
@Override
public List<PiChartsVO> dnuCity(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return Lists.newArrayList();
}
//查询时间范围数据
QueryWrapper<DnuCity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DnuCity::getReportTime,startTime,endTime);
List<DnuCity> dnuCitys = dnuCityService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(dnuCitys)){
return Lists.newArrayList();
}
//按照城市进行分组
Map<String, List<DnuCity>> dnuCityMap = dnuCitys.stream().collect(Collectors.groupingBy(DnuCity::getCity));
Map<String,Long> dnuCityMapHandler = Maps.newHashMap();
BigDecimal total = BigDecimal.ZERO;
//城市注册分布Map
for (Map.Entry<String, List<DnuCity>> entry : dnuCityMap.entrySet()) {
dnuCityMapHandler.put(entry.getKey(),entry.getValue().stream().mapToLong(DnuCity::getDnu).sum());
total = total.add(new BigDecimal(entry.getValue().stream().mapToLong(DnuCity::getDnu).sum()));
}
//超过10个:构建饼状图
if (Long.valueOf(dnuCityMapHandler.size())>10L){
LinkedHashMap<String,Long> longLinkedHashMap = dnuCityMapHandler.entrySet().stream()
.sorted((entry1,entry2)->{return entry2.getValue().compareTo(entry1.getValue());}).limit(10)
.collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue,(oldVal,newVal)->oldVal,LinkedHashMap::new));
List<PiChartsVO> piChartsVOs = Lists.newArrayList();
for (Map.Entry<String, Long> entry : longLinkedHashMap.entrySet()) {
piChartsVOs.add(PiChartsVO.builder()
.name(entry.getKey())
.value(new BigDecimal(entry.getValue()).divide(total,2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)))
.build());
}
//构建其他城市
BigDecimal otherTotal = BigDecimal.ZERO;
BigDecimal topTotal = BigDecimal.ZERO;
for (Map.Entry<String, Long> entry : longLinkedHashMap.entrySet()) {
dnuCityMapHandler.put(entry.getKey(),entry.getValue());
topTotal = topTotal.add(new BigDecimal(entry.getValue()));
}
otherTotal = total.subtract(topTotal);
piChartsVOs.add(PiChartsVO.builder()
.name("其他")
.value(otherTotal.divide(total,2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)))
.build());
return piChartsVOs;
}
//未超过10个:构建饼状图
List<PiChartsVO> piChartsVOs = Lists.newArrayList();
for (Map.Entry<String, Long> entry : dnuCityMapHandler.entrySet()) {
piChartsVOs.add(PiChartsVO.builder()
.name(entry.getKey())
.value(new BigDecimal(entry.getValue()).divide(total,2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)))
.build());
}
return piChartsVOs;
}
@Override
public DauVO dau(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new DauVO();
}
//查询时间范围数据
QueryWrapper<Dau> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(Dau::getReportTime,startTime,endTime).orderByAsc(Dau::getReportTime);
List<Dau> daus = dauService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(daus)){
return new DauVO();
}
DauVO dauVO = new DauVO();
//X轴
List<String> dateRange = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//Y轴
List<Long> valueData = dateRange.stream()
.map(date -> {
return daus.stream()
.filter(dto -> date.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.mapToLong(Dau::getAllDau).sum();
}).collect(Collectors.toList());
//折线表格数据
LineChartsVO lineChartsVO = new LineChartsVO();
lineChartsVO.setLabel(dateRange);
lineChartsVO.setValue(valueData);
dauVO.setTable(lineChartsVO);
//合计
Long total = daus.stream().mapToLong(Dau::getAllDau).sum();
dauVO.setTotal(total);
//均值
LocalDate localDateStartTime = LocalDate.parse(startTime);
LocalDate localDateEndTime = LocalDate.parse(endTime);
dauVO.setAverage(new BigDecimal(total)
.divide(new BigDecimal(localDateStartTime.until(localDateEndTime, ChronoUnit.DAYS)),2,RoundingMode.HALF_UP));
//环比上周=本日/7日前
Dau dauToday = daus.stream()
.filter(dto -> endTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst().orElse(null);
BigDecimal dauTodayBigDecimal = BigDecimal.ZERO;
if (!EmptyUtil.isNullOrEmpty(dauToday)){
dauTodayBigDecimal = new BigDecimal(dauToday.getAllDau());
}
String earlier7Time = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
.plusDays(-7).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Dau dauEarlier7 = daus.stream()
.filter(dto -> earlier7Time.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(dauEarlier7)&&!dauEarlier7.getAllDau().equals(0L)) {
BigDecimal qoqLastWeek = dauTodayBigDecimal
.divide(new BigDecimal(dauEarlier7.getAllDau()), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
dauVO.setQoqLastWeek(qoqLastWeek);
}
//环比上期=本日/昨日
String yesterdayTime = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
.plusDays(-1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Dau dauYesterday = daus.stream()
.filter(dto -> yesterdayTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst().orElse(null);
if (!EmptyUtil.isNullOrEmpty(dauYesterday)&&!dauYesterday.getAllDau().equals(0L)) {
BigDecimal qoq = dauTodayBigDecimal
.divide(new BigDecimal(dauYesterday.getAllDau()), 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
dauVO.setQoq(qoq);
}
//当日总活跃人数
Long perNums = dauTodayBigDecimal.longValue();
dauVO.setPerNums(perNums);
return dauVO;
}
@Override
public StackingChartsVO newOldDau(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new StackingChartsVO();
}
//查询时间范围数据
QueryWrapper<Dau> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(Dau::getReportTime,startTime,endTime);
List<Dau> daus = dauService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(daus)){
return new StackingChartsVO();
}
//X轴
List<String> dateRanges = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.DAYS);
//新用户活跃
List<Long> newDauValues = Lists.newArrayList();
//老用户活跃
List<Long> oldDauValues = Lists.newArrayList();
for (String date : dateRanges) {
Dau dau = daus.stream()
.filter(dto -> date.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.findFirst()
.orElse(null);
if (!EmptyUtil.isNullOrEmpty(dau)){
newDauValues.add(dau.getNewDau());
oldDauValues.add(dau.getOldDau());
}else {
newDauValues.add(0L);
oldDauValues.add(0L);
}
}
List<StackingIndexVO> valueData = Lists.newArrayList();
valueData.add(new StackingIndexVO(newDauValues, "新用户"));
valueData.add(new StackingIndexVO(oldDauValues, "老用户"));
return new StackingChartsVO(dateRanges, valueData);
}
@Override
public LineChartsVO dauRange(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new LineChartsVO();
}
//查询时间范围数据
QueryWrapper<DauRange> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DauRange::getReportTime,startTime,endTime);
List<DauRange> dauRanges = dauRangeService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(dauRanges)){
return new LineChartsVO();
}
// 创建x轴和y轴数据
List<String> xLabels = new ArrayList<>();
//填充x轴内容
xLabels.add("1-5");
xLabels.add("5-10");
xLabels.add("10-20");
xLabels.add("20-40");
xLabels.add("40-80");
xLabels.add("80以上");
List<Long> yValues = new ArrayList<>();
//按照活跃数区间分组
Map<String, List<DauRange>> dauRangeMap = dauRanges.stream().collect(Collectors.groupingBy(DauRange::getDauRang));
//构建y轴内容
for (Map.Entry<String, List<DauRange>> entry : dauRangeMap.entrySet()) {
xLabels.stream().forEach(x->{
if (x.equals(entry.getKey())){
yValues.add(entry.getValue().stream().mapToLong(DauRange::getUserNum).sum());
}
});
}
return new LineChartsVO(xLabels, yValues);
}
@Override
public DauTimeVO dauTime(String startTime, String endTime) {
//起始或结束时间为空则返回空结果
if (EmptyUtil.isNullOrEmpty(startTime)||EmptyUtil.isNullOrEmpty(endTime)){
return new DauTimeVO();
}
//查询时间范围数据
QueryWrapper<DauTime> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().between(DauTime::getReportTime,startTime,endTime);
List<DauTime> dauTimes = dauTimeService.list(queryWrapper);
if (EmptyUtil.isNullOrEmpty(dauTimes)){
return new DauTimeVO();
}
DauTimeVO dauTimeVO = new DauTimeVO();
//X轴
List<String> dateRange = TimeHandlerUtils.getGraduallys(startTime, endTime, TimeUnit.HOURS);
//Y轴
List<Long> valueData = dateRange.stream()
.map(date -> {
return dauTimes.stream()
.filter(dto -> date.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.mapToLong(DauTime::getDau).sum();
}).collect(Collectors.toList());
//折线表格数据
LineChartsVO lineChartsVO = new LineChartsVO();
lineChartsVO.setLabel(dateRange);
lineChartsVO.setValue(valueData);
dauTimeVO.setTable(lineChartsVO);
//合计
Long total = dauTimes.stream().mapToLong(DauTime::getDau).sum();
dauTimeVO.setTotal(total);
//均值
LocalDateTime LocalDateTimeStartTime = LocalDateTime.parse(startTime,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime LocalDateTimeEndTime = LocalDateTime.parse(endTime,DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
dauTimeVO.setAverage(new BigDecimal(total)
.divide(new BigDecimal(LocalDateTimeStartTime.until(LocalDateTimeEndTime, ChronoUnit.DAYS)),2,RoundingMode.HALF_UP));
//环比上周=本日注册/7日前注册
String endTimeHandler = endTime.substring(0,10);
List<DauTime> dauTimeTodays = dauTimes.stream()
.filter(dto -> endTimeHandler.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.toList());
BigDecimal dauTimeTodayBigDecimal = BigDecimal.ZERO;
if (!EmptyUtil.isNullOrEmpty(dauTimeTodays)){
dauTimeTodayBigDecimal = new BigDecimal(dauTimeTodays.stream().mapToLong(DauTime::getDau).sum());
}
String earlier7Time = LocalDate
.parse(endTimeHandler, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-7)
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<DauTime> dauTimeEarliers7 = dauTimes.stream()
.filter(dto -> earlier7Time.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.toList());
BigDecimal dauTimeEarliers7BigDecimal = new BigDecimal(dauTimeEarliers7.stream().mapToLong(DauTime::getDau).sum());
if (dauTimeEarliers7BigDecimal.compareTo(BigDecimal.ZERO)!=0) {
BigDecimal qoqLastWeek = dauTimeTodayBigDecimal
.divide(dauTimeEarliers7BigDecimal, 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
dauTimeVO.setQoqLastWeek(qoqLastWeek);
}
//同比昨日=本日注册/昨日前注册
String yesterdayTime = LocalDate
.parse(endTimeHandler, DateTimeFormatter.ofPattern("yyyy-MM-dd")).plusDays(-1)
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<DauTime> dauTimeYesterdays = dauTimes.stream()
.filter(dto -> yesterdayTime.equals(dto.getReportTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.toList());
BigDecimal dauTimeYesterdaysBigDecimal = new BigDecimal(dauTimeYesterdays.stream().mapToLong(DauTime::getDau).sum());
if (dauTimeYesterdaysBigDecimal.compareTo(BigDecimal.ZERO)!=0) {
BigDecimal qoq = dauTimeEarliers7BigDecimal
.divide(dauTimeYesterdaysBigDecimal, 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100));
dauTimeVO.setQoq(qoq);
}
//当日总活跃人数
Long perNums = dauTimeTodayBigDecimal.longValue();
dauTimeVO.setPerNums(perNums);
return dauTimeVO;
}
}
@@ -0,0 +1,17 @@
package com.itheima.sfbx.points.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sfbx.points.mapper.DauRangeMapper;
import com.itheima.sfbx.points.pojo.DauRange;
import com.itheima.sfbx.points.service.IDauRangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description:用户日活跃数范围服务实现类
*/
@Slf4j
@Service
public class DauRangeServiceImpl extends ServiceImpl<DauRangeMapper, DauRange> implements IDauRangeService {
}
@@ -0,0 +1,17 @@
package com.itheima.sfbx.points.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sfbx.points.mapper.DauMapper;
import com.itheima.sfbx.points.pojo.Dau;
import com.itheima.sfbx.points.service.IDauService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description:用户日活跃数服务实现类
*/
@Slf4j
@Service
public class DauServiceImpl extends ServiceImpl<DauMapper, Dau> implements IDauService {
}
@@ -0,0 +1,17 @@
package com.itheima.sfbx.points.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sfbx.points.mapper.DauTimeMapper;
import com.itheima.sfbx.points.pojo.DauTime;
import com.itheima.sfbx.points.service.IDauTimeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description:用户活跃数时段服务接口实现类
*/
@Slf4j
@Service
public class DauTimeServiceImpl extends ServiceImpl<DauTimeMapper, DauTime> implements IDauTimeService {
}
@@ -0,0 +1,20 @@
package com.itheima.sfbx.points.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sfbx.points.mapper.DnuCityMapper;
import com.itheima.sfbx.points.mapper.DnuMapper;
import com.itheima.sfbx.points.pojo.Dnu;
import com.itheima.sfbx.points.pojo.DnuCity;
import com.itheima.sfbx.points.service.IDnuCityService;
import com.itheima.sfbx.points.service.IDnuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Description:新增用户所属城市服务类接口实现
*/
@Slf4j
@Service
public class DnuCityServiceImpl extends ServiceImpl<DnuCityMapper, DnuCity> implements IDnuCityService {
}

Some files were not shown because too many files have changed in this diff Show More