Merge branch 'master-jdk21' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
# Conflicts: # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessTransferReqVO.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractTransferReqVO.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerTransferReqVO.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/CrmPermissionController.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java # yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java # yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/AppCartAddReqVO.javaplp
commit
b44eab7f93
@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.framework.common.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间间隔的枚举
|
||||||
|
*
|
||||||
|
* @author dhb52
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DateIntervalEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
DAY(1, "天"),
|
||||||
|
WEEK(2, "周"),
|
||||||
|
MONTH(3, "月"),
|
||||||
|
QUARTER(4, "季度"),
|
||||||
|
YEAR(5, "年")
|
||||||
|
;
|
||||||
|
|
||||||
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DateIntervalEnum::getInterval).toArray();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer interval;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateIntervalEnum valueOf(Integer interval) {
|
||||||
|
return ArrayUtil.firstMatch(item -> item.getInterval().equals(interval), DateIntervalEnum.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.framework.excel.core.annotations;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给 Excel 列添加下拉选择数据
|
||||||
|
*
|
||||||
|
* 其中 {@link #dictType()} 和 {@link #functionName()} 二选一
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Inherited
|
||||||
|
public @interface ExcelColumnSelect {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
String dictType() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 获取下拉数据源的方法名称
|
||||||
|
*/
|
||||||
|
String functionName() default "";
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
cn.iocoder.yudao.framework.security.config.YudaoSecurityAutoConfiguration
|
cn.iocoder.yudao.framework.security.config.YudaoSecurityAutoConfiguration
|
||||||
cn.iocoder.yudao.framework.security.config.YudaoWebSecurityConfigurerAdapter
|
cn.iocoder.yudao.framework.security.config.YudaoWebSecurityConfigurerAdapter
|
||||||
cn.iocoder.yudao.framework.operatelog.config.YudaoOperateLogV2Configuration
|
cn.iocoder.yudao.framework.operatelog.config.YudaoOperateLogConfiguration
|
||||||
@ -1,14 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.permission.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 数据权限创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class CrmPermissionCreateReqVO extends CrmPermissionBaseVO {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
# == 1. 客户总量分析 ==
|
||||||
|
### 1.1 客户总量分析(按日期)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-date?deptId=100&interval=2×[0]=2024-01-01 00:00:00×[1]=2024-01-29 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 1.2 客户总量统计(按用户)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-user?deptId=100×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
# == 2. 客户跟进次数分析 ==
|
||||||
|
### 2.1 客户跟进次数分析(按日期)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-date?deptId=100&interval=2×[0]=2024-01-01 00:00:00×[1]=2024-01-29 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 2.2 客户总量统计(按用户)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-user?deptId=100×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
# == 3. 客户跟进方式分析 ==
|
||||||
|
### 3.1 客户跟进方式分析
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-type?deptId=100&interval=2×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
# == 4. 客户成交周期 ==
|
||||||
|
### 4.1 合同摘要信息(客户转化率页面)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-contract-summary?deptId=100&interval=2×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
# == 5. 客户成交周期 ==
|
||||||
|
### 5.1 获取客户公海分析(按日期)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-pool-summary-by-date?deptId=100&interval=2×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 5.2 获取客户公海分析(按用户)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-pool-summary-by-user?deptId=100×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
# == 6. 客户成交周期 ==
|
||||||
|
### 6.1 客户成交周期(按日期)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-date?deptId=100&interval=2×[0]=2024-01-01 00:00:00×[1]=2024-01-29 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
### 6.2 获取客户成交周期(按用户)
|
||||||
|
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-user?deptId=100×[0]=2023-01-01 00:00:00×[1]=2024-12-12 23:59:59
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.statistics.CrmStatisticsPerformanceService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - CRM 员工业绩统计")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crm/statistics-performance")
|
||||||
|
@Validated
|
||||||
|
public class CrmStatisticsPerformanceController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmStatisticsPerformanceService performanceService;
|
||||||
|
|
||||||
|
@GetMapping("/get-contract-count-performance")
|
||||||
|
@Operation(summary = "合同数量统计", description = "用于【合同数量分析】页面")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
|
||||||
|
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractCountPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
|
||||||
|
return success(performanceService.getContractCountPerformance(performanceReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-contract-price-performance")
|
||||||
|
@Operation(summary = "合同金额统计")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
|
||||||
|
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractPriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
|
||||||
|
return success(performanceService.getContractPricePerformance(performanceReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-receivable-price-performance")
|
||||||
|
@Operation(summary = "回款金额统计")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')")
|
||||||
|
public CommonResult<List<CrmStatisticsPerformanceRespVO>> getReceivablePriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) {
|
||||||
|
return success(performanceService.getReceivablePricePerformance(performanceReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticsPortraitReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerAreaRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerIndustryRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerLevelRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerSourceRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.statistics.CrmStatisticsPortraitService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - CRM 客户画像")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crm/statistics-portrait")
|
||||||
|
@Validated
|
||||||
|
public class CrmStatisticsPortraitController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmStatisticsPortraitService statisticsPortraitService;
|
||||||
|
|
||||||
|
@GetMapping("/get-customer-area-summary")
|
||||||
|
@Operation(summary = "获取客户地区统计数据", description = "用于【城市分布分析】页面")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-portrait:query')")
|
||||||
|
public CommonResult<List<CrmStatisticCustomerAreaRespVO>> getCustomerAreaSummary(@Valid CrmStatisticsPortraitReqVO reqVO) {
|
||||||
|
return success(statisticsPortraitService.getCustomerSummaryByArea(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-customer-industry-summary")
|
||||||
|
@Operation(summary = "获取客户行业统计数据", description = "用于【客户行业分析】页面")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-portrait:query')")
|
||||||
|
public CommonResult<List<CrmStatisticCustomerIndustryRespVO>> getCustomerIndustrySummary(@Valid CrmStatisticsPortraitReqVO reqVO) {
|
||||||
|
return success(statisticsPortraitService.getCustomerSummaryByIndustry(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-customer-level-summary")
|
||||||
|
@Operation(summary = "获取客户级别统计数据", description = "用于【客户级别分析】页面")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-portrait:query')")
|
||||||
|
public CommonResult<List<CrmStatisticCustomerLevelRespVO>> getCustomerLevelSummary(@Valid CrmStatisticsPortraitReqVO reqVO) {
|
||||||
|
return success(statisticsPortraitService.getCustomerSummaryByLevel(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-customer-source-summary")
|
||||||
|
@Operation(summary = "获取客户来源统计数据", description = "用于【客户来源分析】页面")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:statistics-portrait:query')")
|
||||||
|
public CommonResult<List<CrmStatisticCustomerSourceRespVO>> getCustomerSourceSummary(@Valid CrmStatisticsPortraitReqVO reqVO) {
|
||||||
|
return success(statisticsPortraitService.getCustomerSummaryBySource(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户转化率分析 VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsCustomerContractSummaryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "演示合同")
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
@Schema(description = "合同总金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1200.00")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "回款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1200.00")
|
||||||
|
private BigDecimal receivablePrice;
|
||||||
|
|
||||||
|
@Schema(description = "客户行业编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer industryId;
|
||||||
|
|
||||||
|
@Schema(description = "客户来源编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
@Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long ownerUserId;
|
||||||
|
@Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
|
||||||
|
private String ownerUserName;
|
||||||
|
|
||||||
|
@Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private String creator;
|
||||||
|
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "源码")
|
||||||
|
private String creatorUserName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-02-01 13:24:26")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-02-02 00:00:00")
|
||||||
|
private LocalDateTime orderDate;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户成交周期分析(按日期) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsCustomerDealCycleByDateRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Schema(description = "成交周期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1.0")
|
||||||
|
private Double customerDealCycle;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 成交周期分析(按用户) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsCustomerDealCycleByUserRespVO extends CrmStatisticsCustomerByUserBaseRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "成交周期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1.0")
|
||||||
|
private Double customerDealCycle;
|
||||||
|
|
||||||
|
@Schema(description = "成交客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerDealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户总量分析(按日期) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsCustomerSummaryByDateRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Schema(description = "新建客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCreateCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerDealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户总量分析(按用户) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsCustomerSummaryByUserRespVO extends CrmStatisticsCustomerByUserBaseRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "新建客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCreateCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerDealCount;
|
||||||
|
|
||||||
|
@Schema(description = "合同总金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
|
||||||
|
private BigDecimal contractPrice;
|
||||||
|
|
||||||
|
@Schema(description = "回款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
|
||||||
|
private BigDecimal receivablePrice;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 跟进次数分析(按日期) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsFollowUpSummaryByDateRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Schema(description = "跟进次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpRecordCount;
|
||||||
|
|
||||||
|
@Schema(description = "跟进客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpCustomerCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 跟进次数分析(按类型) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsFollowUpSummaryByTypeRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpType;
|
||||||
|
|
||||||
|
@Schema(description = "跟进次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpRecordCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 跟进次数分析(按用户) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsFollowUpSummaryByUserRespVO extends CrmStatisticsCustomerByUserBaseRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "跟进次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpRecordCount;
|
||||||
|
|
||||||
|
@Schema(description = "跟进客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer followUpCustomerCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 公海客户分析(按日期) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsPoolSummaryByDateRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Schema(description = "进入公海客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerPutCount;
|
||||||
|
|
||||||
|
@Schema(description = "公海领取客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerTakeCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 公海客户分析(按用户) VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsPoolSummaryByUserRespVO extends CrmStatisticsCustomerByUserBaseRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "进入公海客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerPutCount;
|
||||||
|
|
||||||
|
@Schema(description = "公海领取客户数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerTakeCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 员工业绩统计 Response VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticsPerformanceRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
@Schema(description = "当月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private BigDecimal currentMonthCount;
|
||||||
|
|
||||||
|
@Schema(description = "上月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private BigDecimal lastMonthCount;
|
||||||
|
|
||||||
|
@Schema(description = "去年同期统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||||
|
private BigDecimal lastYearCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户省份分析 VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticCustomerAreaRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "省份编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer areaId;
|
||||||
|
@Schema(description = "省份名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "浙江省")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@Schema(description = "客户个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer dealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户行业分析 VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticCustomerIndustryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "客户行业ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer industryId;
|
||||||
|
|
||||||
|
@Schema(description = "客户个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer dealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户级别分析 VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticCustomerLevelRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "客户级别编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
@Schema(description = "客户个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer dealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户来源分析 VO")
|
||||||
|
@Data
|
||||||
|
public class CrmStatisticCustomerSourceRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "客户来源编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
@Schema(description = "客户个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer customerCount;
|
||||||
|
|
||||||
|
@Schema(description = "成交个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer dealCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,194 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.statistics;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer.*;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM 客户分析 Mapper
|
||||||
|
*
|
||||||
|
* @author dhb52
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmStatisticsCustomerMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建客户数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByDateRespVO> selectCustomerCreateCountGroupByDate(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成交客户数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByDateRespVO> selectCustomerDealCountGroupByDate(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建客户数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByUserRespVO> selectCustomerCreateCountGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成交客户数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数@param reqVO 请求参数@param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByUserRespVO> selectCustomerDealCountGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同总金额(按用户)
|
||||||
|
* @return 统计数据@return 统计数据@param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByUserRespVO> selectContractPriceGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同回款金额(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerSummaryByUserRespVO> selectReceivablePriceGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进次数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsFollowUpSummaryByDateRespVO> selectFollowUpRecordCountGroupByDate(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进客户数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsFollowUpSummaryByDateRespVO> selectFollowUpCustomerCountGroupByDate(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进次数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsFollowUpSummaryByUserRespVO> selectFollowUpRecordCountGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进客户数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsFollowUpSummaryByUserRespVO> selectFollowUpCustomerCountGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首次合同、回款信息(用于【客户转化率】页面)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerContractSummaryRespVO> selectContractSummary(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进次数(按类型)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsFollowUpSummaryByTypeRespVO> selectFollowUpRecordCountGroupByType(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入公海客户数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
// TODO: @芋艿 模拟数据, 需要增加 crm_owner_record 表
|
||||||
|
default List<CrmStatisticsPoolSummaryByDateRespVO> selectPoolCustomerPutCountByDate(CrmStatisticsCustomerReqVO reqVO) {
|
||||||
|
LocalDateTime currrentDate = LocalDateTimeUtil.beginOfDay(reqVO.getTimes()[0]);
|
||||||
|
LocalDateTime endDate = LocalDateTimeUtil.endOfDay(reqVO.getTimes()[1]);
|
||||||
|
List<CrmStatisticsPoolSummaryByDateRespVO> voList = new ArrayList<>();
|
||||||
|
while (currrentDate.isBefore(endDate)) {
|
||||||
|
voList.add(new CrmStatisticsPoolSummaryByDateRespVO()
|
||||||
|
.setTime(LocalDateTimeUtil.format(currrentDate, "yyyy-MM-dd"))
|
||||||
|
.setCustomerPutCount(RandomUtil.randomInt(0, 10))
|
||||||
|
.setCustomerTakeCount(RandomUtil.randomInt(0, 10)));
|
||||||
|
currrentDate = currrentDate.plusDays(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return voList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公海领取客户数(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
// TODO: @芋艿 模拟数据, 需要增加 crm_owner_record 表
|
||||||
|
default List<CrmStatisticsPoolSummaryByDateRespVO> selectPoolCustomerTakeCountByDate(CrmStatisticsCustomerReqVO reqVO) {
|
||||||
|
return selectPoolCustomerPutCountByDate(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入公海客户数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
// TODO: @芋艿 模拟数据, 需要增加 crm_owner_record 表
|
||||||
|
default List<CrmStatisticsPoolSummaryByUserRespVO> selectPoolCustomerPutCountByUser(CrmStatisticsCustomerReqVO reqVO) {
|
||||||
|
return convertList(reqVO.getUserIds(), userId ->
|
||||||
|
(CrmStatisticsPoolSummaryByUserRespVO) new CrmStatisticsPoolSummaryByUserRespVO()
|
||||||
|
.setCustomerPutCount(RandomUtil.randomInt(0, 10))
|
||||||
|
.setCustomerTakeCount(RandomUtil.randomInt(0, 10))
|
||||||
|
.setOwnerUserId(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公海领取客户数(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
// TODO: @芋艿 模拟数据, 需要增加 crm_owner_record 表
|
||||||
|
default List<CrmStatisticsPoolSummaryByUserRespVO> selectPoolCustomerTakeCountByUser(CrmStatisticsCustomerReqVO reqVO) {
|
||||||
|
return selectPoolCustomerPutCountByUser(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户成交周期(按日期)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerDealCycleByDateRespVO> selectCustomerDealCycleGroupByDate(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户成交周期(按用户)
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsCustomerDealCycleByUserRespVO> selectCustomerDealCycleGroupByUser(CrmStatisticsCustomerReqVO reqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.statistics;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM 员工业绩分析 Mapper
|
||||||
|
*
|
||||||
|
* @author scholar
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmStatisticsPerformanceMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工签约合同数量
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 参数
|
||||||
|
* @return 员工签约合同数量
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> selectContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工签约合同金额
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 参数
|
||||||
|
* @return 员工签约合同金额
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> selectContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工回款金额
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 参数
|
||||||
|
* @return 员工回款金额
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> selectReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.statistics;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM 数据画像 Mapper
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmStatisticsPortraitMapper {
|
||||||
|
|
||||||
|
List<CrmStatisticCustomerAreaRespVO> selectSummaryListGroupByAreaId(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
List<CrmStatisticCustomerIndustryRespVO> selectCustomerIndustryListGroupByIndustryId(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
List<CrmStatisticCustomerSourceRespVO> selectCustomerSourceListGroupBySource(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
List<CrmStatisticCustomerLevelRespVO> selectCustomerLevelListGroupByLevel(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* crm 模块的 excel 拓展封装
|
||||||
|
*/
|
||||||
|
package cn.iocoder.yudao.module.crm.framework.excel;
|
||||||
@ -1 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* crm 模块的 operatelog 拓展封装
|
||||||
|
*/
|
||||||
package cn.iocoder.yudao.module.crm.framework.operatelog;
|
package cn.iocoder.yudao.module.crm.framework.operatelog;
|
||||||
@ -1 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* crm 模块的 permission 拓展封装
|
||||||
|
*/
|
||||||
package cn.iocoder.yudao.module.crm.framework.permission;
|
package cn.iocoder.yudao.module.crm.framework.permission;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* trade 模块的 web 配置
|
* crm 模块的 web 拓展封装
|
||||||
*/
|
*/
|
||||||
package cn.iocoder.yudao.module.crm.framework.web;
|
package cn.iocoder.yudao.module.crm.framework.web;
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.statistics;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM 员工绩效统计 Service 接口
|
||||||
|
*
|
||||||
|
* @author scholar
|
||||||
|
*/
|
||||||
|
public interface CrmStatisticsPerformanceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工签约合同数量分析
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 排行参数
|
||||||
|
* @return 员工签约合同数量排行分析
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工签约合同金额分析
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 排行参数
|
||||||
|
* @return 员工签约合同金额分析
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> getContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工获得回款金额分析
|
||||||
|
*
|
||||||
|
* @param performanceReqVO 排行参数
|
||||||
|
* @return 员工获得回款金额分析
|
||||||
|
*/
|
||||||
|
List<CrmStatisticsPerformanceRespVO> getReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.statistics;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRM 客户画像 Service 接口
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
public interface CrmStatisticsPortraitService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户地区统计数据
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户行业统计数据
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticCustomerIndustryRespVO> getCustomerSummaryByIndustry(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户级别统计数据
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticCustomerLevelRespVO> getCustomerSummaryByLevel(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户来源统计数据
|
||||||
|
*
|
||||||
|
* @param reqVO 请求参数
|
||||||
|
* @return 统计数据
|
||||||
|
*/
|
||||||
|
List<CrmStatisticCustomerSourceRespVO> getCustomerSummaryBySource(CrmStatisticsPortraitReqVO reqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPerformanceMapper">
|
||||||
|
|
||||||
|
<select id="selectContractCountPerformance"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO">
|
||||||
|
SELECT
|
||||||
|
t.time as time,
|
||||||
|
COALESCE(t.currentMonthCount,0) as currentMonthCount,
|
||||||
|
COALESCE(y.lastMonthCount,0) as lastMonthCount,
|
||||||
|
COALESCE(z.lastYearCount,0) as lastYearCount
|
||||||
|
FROM
|
||||||
|
(SELECT
|
||||||
|
COUNT(1) AS currentMonthCount,
|
||||||
|
DATE_FORMAT(order_date, '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
GROUP BY time)t
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
COUNT(1) AS lastMonthCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(order_date,INTERVAL 1 MONTH), '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND (DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
or DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1)
|
||||||
|
GROUP BY time)y ON t.time = y.time
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
COUNT(1) AS lastYearCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(order_date,INTERVAL 1 YEAR), '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1
|
||||||
|
GROUP BY time)z ON t.time = z.time
|
||||||
|
</select>
|
||||||
|
<select id="selectContractPricePerformance"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO">
|
||||||
|
SELECT
|
||||||
|
t.time as time,
|
||||||
|
COALESCE(t.currentMonthCount,0) as currentMonthCount,
|
||||||
|
COALESCE(y.lastMonthCount,0) as lastMonthCount,
|
||||||
|
COALESCE(z.lastYearCount,0) as lastYearCount
|
||||||
|
FROM
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(total_price), 0) AS currentMonthCount,
|
||||||
|
DATE_FORMAT(order_date, '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
GROUP BY time)t
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(total_price), 0) AS lastMonthCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(order_date,INTERVAL 1 MONTH), '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND (DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
or DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1)
|
||||||
|
GROUP BY time)y ON t.time = y.time
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(total_price), 0) AS lastYearCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(order_date,INTERVAL 1 YEAR), '%Y-%m') AS time
|
||||||
|
FROM crm_contract
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(order_date, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1
|
||||||
|
GROUP BY time)z ON t.time = z.time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReceivablePricePerformance"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO">
|
||||||
|
SELECT
|
||||||
|
t.time as time,
|
||||||
|
COALESCE(t.currentMonthCount,0) as currentMonthCount,
|
||||||
|
COALESCE(y.lastMonthCount,0) as lastMonthCount,
|
||||||
|
COALESCE(z.lastYearCount,0) as lastYearCount
|
||||||
|
FROM
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(price), 0) AS currentMonthCount,
|
||||||
|
DATE_FORMAT(return_time, '%Y-%m') AS time
|
||||||
|
FROM crm_receivable
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(return_time, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
GROUP BY time)t
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(price), 0) AS lastMonthCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(return_time,INTERVAL 1 MONTH), '%Y-%m') AS time
|
||||||
|
FROM crm_receivable
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND (DATE_FORMAT(return_time, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')
|
||||||
|
or DATE_FORMAT(return_time, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1)
|
||||||
|
GROUP BY time)y ON t.time = y.time
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT
|
||||||
|
IFNULL(SUM(price), 0) AS lastYearCount,
|
||||||
|
DATE_FORMAT(DATE_ADD(return_time,INTERVAL 1 YEAR), '%Y-%m') AS time
|
||||||
|
FROM crm_receivable
|
||||||
|
WHERE deleted = 0
|
||||||
|
AND audit_status = 20
|
||||||
|
AND owner_user_id in
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND DATE_FORMAT(return_time, '%Y') = DATE_FORMAT(#{times[0],javaType=java.time.LocalDateTime},'%Y')-1
|
||||||
|
GROUP BY time)z ON t.time = z.time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPortraitMapper">
|
||||||
|
|
||||||
|
<select id="selectSummaryListGroupByAreaId"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerAreaRespVO">
|
||||||
|
SELECT area_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount
|
||||||
|
FROM crm_customer
|
||||||
|
WHERE deleted = 0 AND area_id IS NOT NULL
|
||||||
|
AND owner_user_id IN
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime}
|
||||||
|
AND #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY area_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustomerIndustryListGroupByIndustryId"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerIndustryRespVO">
|
||||||
|
SELECT industry_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount
|
||||||
|
FROM crm_customer
|
||||||
|
WHERE deleted = 0 AND industry_id IS NOT NULL
|
||||||
|
AND owner_user_id IN
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime}
|
||||||
|
AND #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY industry_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustomerSourceListGroupBySource"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerSourceRespVO">
|
||||||
|
SELECT source, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount
|
||||||
|
FROM crm_customer
|
||||||
|
WHERE deleted = 0 AND source IS NOT NULL
|
||||||
|
AND owner_user_id IN
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime}
|
||||||
|
AND #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY source
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCustomerLevelListGroupByLevel"
|
||||||
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerLevelRespVO">
|
||||||
|
SELECT level, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount
|
||||||
|
FROM crm_customer
|
||||||
|
WHERE deleted = 0 AND level IS NOT NULL
|
||||||
|
AND owner_user_id IN
|
||||||
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime}
|
||||||
|
AND #{times[1],javaType=java.time.LocalDateTime}
|
||||||
|
GROUP BY level
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -1,125 +1,117 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankingMapper">
|
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankMapper">
|
||||||
|
|
||||||
<select id="selectContractPriceRank"
|
<select id="selectContractPriceRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT IFNULL(SUM(total_price), 0) AS count, owner_user_id
|
SELECT IFNULL(SUM(total_price), 0) AS count, owner_user_id
|
||||||
FROM crm_contract
|
FROM crm_contract
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
AND audit_status = 20
|
AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
|
||||||
and owner_user_id in
|
and owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
|
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY owner_user_id
|
GROUP BY owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectReceivablePriceRank"
|
<select id="selectReceivablePriceRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
|
SELECT IFNULL(SUM(price), 0) AS count, owner_user_id
|
||||||
FROM crm_receivable
|
FROM crm_receivable
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
AND audit_status = 20
|
AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
|
||||||
AND owner_user_id in
|
AND owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND return_time between #{times[0],javaType=java.time.LocalDateTime} and
|
AND return_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY owner_user_id
|
GROUP BY owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectContractCountRank"
|
<select id="selectContractCountRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(1) AS count, owner_user_id
|
SELECT COUNT(1) AS count, owner_user_id
|
||||||
FROM crm_contract
|
FROM crm_contract
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
AND audit_status = 20
|
AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
|
||||||
AND owner_user_id in
|
AND owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
|
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY owner_user_id
|
GROUP BY owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- TODO 待定 这里是否需要关联 crm_contract_product 表,计算销售额 -->
|
|
||||||
<select id="selectProductSalesRank"
|
<select id="selectProductSalesRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(1) AS count, owner_user_id
|
SELECT COUNT(product.count) AS count, contract.owner_user_id
|
||||||
FROM crm_contract
|
FROM crm_contract_product product
|
||||||
WHERE deleted = 0
|
INNER JOIN crm_contract contract ON product.contract_id = contract.id
|
||||||
AND audit_status = 20
|
WHERE contract.deleted = 0 AND contract.deleted = 0
|
||||||
AND owner_user_id in
|
AND contract.audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
AND contract.owner_user_id in
|
||||||
#{userId}
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
</foreach>
|
#{userId}
|
||||||
AND order_date between #{times[0],javaType=java.time.LocalDateTime} and
|
</foreach>
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
AND contract.order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
GROUP BY owner_user_id
|
GROUP BY contract.owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCustomerCountRank"
|
<select id="selectCustomerCountRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(1) AS count, owner_user_id
|
SELECT COUNT(1) AS count, owner_user_id
|
||||||
FROM crm_customer
|
FROM crm_customer
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
AND owner_user_id in
|
AND owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
|
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY owner_user_id
|
GROUP BY owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectContactsCountRank"
|
<select id="selectContactsCountRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(1) AS count, owner_user_id
|
SELECT COUNT(1) AS count, owner_user_id
|
||||||
FROM crm_contact
|
FROM crm_contact
|
||||||
WHERE deleted = 0
|
WHERE deleted = 0
|
||||||
AND owner_user_id in
|
AND owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and
|
AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY owner_user_id
|
GROUP BY owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectFollowCountRank"
|
<select id="selectFollowCountRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(1) AS count, cc.owner_user_id
|
SELECT COUNT(1) AS count, cc.owner_user_id
|
||||||
FROM crm_follow_up_record AS cfur
|
FROM crm_follow_up_record AS cfur
|
||||||
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
|
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
|
||||||
WHERE cfur.deleted = 0
|
WHERE cfur.deleted = 0
|
||||||
AND cc.deleted = 0
|
AND cc.deleted = 0
|
||||||
AND cc.owner_user_id in
|
AND cc.owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
|
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY cc.owner_user_id
|
GROUP BY cc.owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectFollowCustomerCountRank"
|
<select id="selectFollowCustomerCountRank"
|
||||||
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.CrmStatisticsRanKRespVO">
|
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO">
|
||||||
SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id
|
SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id
|
||||||
FROM crm_follow_up_record AS cfur
|
FROM crm_follow_up_record AS cfur
|
||||||
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
|
LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids)
|
||||||
WHERE cfur.deleted = 0
|
WHERE cfur.deleted = 0
|
||||||
AND cc.deleted = 0
|
AND cc.deleted = 0
|
||||||
AND cc.owner_user_id in
|
AND cc.owner_user_id in
|
||||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and
|
AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime}
|
||||||
#{times[1],javaType=java.time.LocalDateTime}
|
|
||||||
GROUP BY cc.owner_user_id
|
GROUP BY cc.owner_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue