!934 增加公海客户分析(mapper模拟数据)

Merge pull request !934 from dhb52/develop
This commit is contained in:
芋道源码 2024-04-07 12:39:38 +00:00 committed by Gitee
commit 60ac63416a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 310 additions and 50 deletions

View File

@ -249,8 +249,11 @@ public class LocalDateTimeUtils {
break;
case DateIntervalEnum.QUARTER:
while (startTime.isBefore(endTime)) {
LocalDateTime quarterEnd = startTime.withMonth(getQuarterOfYear(startTime) * 3 + 1)
.withDayOfMonth(1).minusNanos(1);
int quarterOfYear = getQuarterOfYear(startTime);
LocalDateTime quarterEnd =
quarterOfYear == 4
? startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1)
: startTime.withMonth(quarterOfYear * 3 + 1).withDayOfMonth(1).minusNanos(1);
timeRanges.add(new LocalDateTime[]{startTime, quarterEnd});
startTime = quarterEnd.plusNanos(1);
}

View File

@ -1,68 +1,58 @@
# == 1. 客户总量分析 ==
### 1.1 客户总量分析(按日)
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-date?deptId=100&interval=1&times[0]=2024-01-01 00:00:00&times[1]=2024-01-29 23:59:59
### 1.1 客户总量分析(按日)
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-date?deptId=100&interval=2&times[0]=2024-01-01 00:00:00&times[1]=2024-01-29 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 1.2 客户总量分析(按月)
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-date?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 1.3 客户总量统计(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-user?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
### 1.2 客户总量统计(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-customer-summary-by-user?deptId=100&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
# == 2. 客户跟进次数分析 ==
### 2.1 客户跟进次数分析(按日)
GET {{baseUrl}}/crm/statistics-customer/get-followup-summary-by-date?deptId=100&intervalType=11&times[0]=2024-01-01 00:00:00&times[1]=2024-01-29 23:59:59
### 2.1 客户跟进次数分析(按日)
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-date?deptId=100&interval=2&times[0]=2024-01-01 00:00:00&times[1]=2024-01-29 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 2.2 客户跟进次数分析(按月)
GET {{baseUrl}}/crm/statistics-customer/get-followup-summary-by-date?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 2.3 客户总量统计(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-followup-summary-by-user?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
### 2.2 客户总量统计(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-user?deptId=100&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
# == 3. 客户跟进方式分析 ==
### 3.1 客户跟进方式分析
GET {{baseUrl}}/crm/statistics-customer/get-followup-summary-by-type?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
GET {{baseUrl}}/crm/statistics-customer/get-follow-up-summary-by-type?deptId=100&interval=2&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
tenant-id: {{adminTenentId}}
# == 4. 客户成交周期 ==
### 4.1 合同摘要信息(客户转化率页面)
GET {{baseUrl}}/crm/statistics-customer/get-contract-summary?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
GET {{baseUrl}}/crm/statistics-customer/get-contract-summary?deptId=100&interval=2&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
tenant-id: {{adminTenentId}}
# == 5. 客户成交周期 ==
### 5.1 客户成交周期(按日)
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-date?deptId=100&intervalType=11&times[0]=2024-01-01 00:00:00&times[1]=2024-01-29 23:59:59
### 5.1 获取客户公海分析(按日期)
GET {{baseUrl}}/crm/statistics-customer/get-pool-summary-by-date?deptId=100&interval=2&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
tenant-id: {{adminTenentId}}
### 5.2 客户成交周期(按月)
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-date?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
### 5.2 获取客户公海分析(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-pool-summary-by-user?deptId=100&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
tenant-id: {{adminTenentId}}
### 5.3 获取客户成交周期(按用户)
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-user?deptId=100&intervalType=11&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
# == 6. 客户成交周期 ==
### 6.1 客户成交周期(按日期)
GET {{baseUrl}}/crm/statistics-customer/get-customer-deal-cycle-by-date?deptId=100&interval=2&times[0]=2024-01-01 00:00:00&times[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&times[0]=2023-01-01 00:00:00&times[1]=2024-12-12 23:59:59
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -61,8 +61,6 @@ public class CrmStatisticsCustomerController {
return success(customerService.getFollowUpSummaryByType(reqVO));
}
// TODO @dhb52客户转化率应该少了一个接口给上面图标的
@GetMapping("/get-contract-summary")
@Operation(summary = "获取客户的首次合同、回款信息列表", description = "用于【客户转化率】页面")
@PreAuthorize("@ss.hasPermission('crm:statistics-customer:query')")
@ -70,6 +68,20 @@ public class CrmStatisticsCustomerController {
return success(customerService.getContractSummary(reqVO));
}
@GetMapping("/get-pool-summary-by-date")
@Operation(summary = "获取客户成交周期(按日期)")
@PreAuthorize("@ss.hasPermission('crm:statistics-customer:query')")
public CommonResult<List<CrmStatisticsPoolSummaryByDateRespVO>> getPoolSummaryByDate(@Valid CrmStatisticsCustomerReqVO reqVO) {
return success(customerService.getPoolSummaryByDate(reqVO));
}
@GetMapping("/get-pool-summary-by-user")
@Operation(summary = "获取客户成交周期(按用户)")
@PreAuthorize("@ss.hasPermission('crm:statistics-customer:query')")
public CommonResult<List<CrmStatisticsPoolSummaryByUserRespVO>> getPoolSummaryByUser(@Valid CrmStatisticsCustomerReqVO reqVO) {
return success(customerService.getPoolSummaryByUser(reqVO));
}
@GetMapping("/get-customer-deal-cycle-by-date")
@Operation(summary = "获取客户成交周期(按日期)")
@PreAuthorize("@ss.hasPermission('crm:statistics-customer:query')")

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.DateIntervalEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -37,12 +38,9 @@ public class CrmStatisticsCustomerReqVO {
@InEnum(value = DateIntervalEnum.class, message = "时间间隔类型,必须是 {value}")
private Integer interval;
/**
* 前端如果选择自定义时间, 那么前端传递起始-终止时间, 如果选择其他时间间隔类型, 则由后台计算起始-终止时间
* 并作为参数传递给Mapper
*/
@Schema(description = "时间范围", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@Size(min = 2, max = 2, message = "请选择时间范围")
private LocalDateTime[] times;
}

View File

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

View File

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

View File

@ -1,44 +1,195 @@
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
* 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);
}

View File

@ -55,10 +55,26 @@ public interface CrmStatisticsCustomerService {
* 获取客户的首次合同回款信息列表用于客户转化率页面
*
* @param reqVO 请求参数
* @return 客户的首次合同回款信息列表
* @return 统计数据
*/
List<CrmStatisticsCustomerContractSummaryRespVO> getContractSummary(CrmStatisticsCustomerReqVO reqVO);
/**
* 公海客户分析(按日期)
*
* @param reqVO 请求参数
* @return 统计数据
*/
List<CrmStatisticsPoolSummaryByDateRespVO> getPoolSummaryByDate(CrmStatisticsCustomerReqVO reqVO);
/**
* 公海客户分析(按用户)
*
* @param reqVO 请求参数
* @return 统计数据
*/
List<CrmStatisticsPoolSummaryByUserRespVO> getPoolSummaryByUser(CrmStatisticsCustomerReqVO reqVO);
/**
* 客户成交周期(按日期)
*

View File

@ -187,6 +187,60 @@ public class CrmStatisticsCustomerServiceImpl implements CrmStatisticsCustomerSe
return summaryList;
}
@Override
public List<CrmStatisticsPoolSummaryByDateRespVO> getPoolSummaryByDate(CrmStatisticsCustomerReqVO reqVO) {
// 1. 获得用户编号数组
reqVO.setUserIds(getUserIds(reqVO));
if (CollUtil.isEmpty(reqVO.getUserIds())) {
return Collections.emptyList();
}
// 2. 按天统计获取分项统计数据
List<CrmStatisticsPoolSummaryByDateRespVO> customerPutCountList = customerMapper.selectPoolCustomerPutCountByDate(reqVO);
List<CrmStatisticsPoolSummaryByDateRespVO> customerTakeCountList = customerMapper.selectPoolCustomerTakeCountByDate(reqVO);
// 3. 按照日期间隔合并数据
List<LocalDateTime[]> timeRanges = LocalDateTimeUtils.getDateRangeList(reqVO.getTimes()[0], reqVO.getTimes()[1], reqVO.getInterval());
return convertList(timeRanges, times -> {
Integer customerPutCount = customerPutCountList.stream()
.filter(vo -> LocalDateTimeUtils.isBetween(times[0], times[1], vo.getTime()))
.mapToInt(CrmStatisticsPoolSummaryByDateRespVO::getCustomerPutCount).sum();
Integer customerTakeCount = customerTakeCountList.stream()
.filter(vo -> LocalDateTimeUtils.isBetween(times[0], times[1], vo.getTime()))
.mapToInt(CrmStatisticsPoolSummaryByDateRespVO::getCustomerTakeCount).sum();
return new CrmStatisticsPoolSummaryByDateRespVO()
.setTime(LocalDateTimeUtils.formatDateRange(times[0], times[1], reqVO.getInterval()))
.setCustomerPutCount(customerPutCount).setCustomerTakeCount(customerTakeCount);
});
}
@Override
public List<CrmStatisticsPoolSummaryByUserRespVO> getPoolSummaryByUser(CrmStatisticsCustomerReqVO reqVO) {
// 1. 获得用户编号数组
reqVO.setUserIds(getUserIds(reqVO));
if (CollUtil.isEmpty(reqVO.getUserIds())) {
return Collections.emptyList();
}
// 2. 按用户统计获取分项统计数据
List<CrmStatisticsPoolSummaryByUserRespVO> customerPutCountList = customerMapper.selectPoolCustomerPutCountByUser(reqVO);
List<CrmStatisticsPoolSummaryByUserRespVO> customerTakeCountList = customerMapper.selectPoolCustomerTakeCountByUser(reqVO);
// 3.1 按照用户合并统计数据
List<CrmStatisticsPoolSummaryByUserRespVO> summaryList = convertList(reqVO.getUserIds(), userId -> {
Integer customerPutCount = customerPutCountList.stream().filter(vo -> userId.equals(vo.getOwnerUserId()))
.mapToInt(CrmStatisticsPoolSummaryByUserRespVO::getCustomerPutCount).sum();
Integer customerTakeCount = customerTakeCountList.stream().filter(vo -> userId.equals(vo.getOwnerUserId()))
.mapToInt(CrmStatisticsPoolSummaryByUserRespVO::getCustomerTakeCount).sum();
return (CrmStatisticsPoolSummaryByUserRespVO) new CrmStatisticsPoolSummaryByUserRespVO()
.setCustomerPutCount(customerPutCount).setCustomerTakeCount(customerTakeCount)
.setOwnerUserId(userId);
});
// 3.2 拼接用户信息
appendUserInfo(summaryList);
return summaryList;
}
@Override
public List<CrmStatisticsCustomerDealCycleByDateRespVO> getCustomerDealCycleByDate(CrmStatisticsCustomerReqVO reqVO) {
// 1. 获得用户编号数组

View File

@ -18,16 +18,17 @@
<select id="selectCustomerDealCountGroupByDate"
resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer.CrmStatisticsCustomerSummaryByDateRespVO">
SELECT DATE_FORMAT(order_date, '%Y-%m-%d') AS time,
COUNT(DISTINCT customer_id) AS customerDealCount
FROM crm_contract
WHERE deleted = 0
AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
AND owner_user_id IN
SELECT DATE_FORMAT(customer.create_time, '%Y-%m-%d') AS time,
COUNT(DISTINCT customer.id) AS customer_deal_count
FROM crm_customer AS customer
LEFT JOIN crm_contract AS contract ON contract.customer_id = customer.id
WHERE customer.deleted = 0 AND contract.deleted = 0
AND contract.audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status}
AND customer.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}
AND contract.create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND #{times[1],javaType=java.time.LocalDateTime}
GROUP BY time
</select>