mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	CRM:完善【排行版】功能
This commit is contained in:
		| @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
|  | ||||
|  | ||||
| @Schema(description = "管理后台 - CRM 排行榜统计 Response VO") | ||||
| @Data | ||||
| @@ -17,14 +19,15 @@ public class CrmStatisticsRankRespVO { | ||||
|     @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||||
|     private String deptName; | ||||
|  | ||||
|     // TODO @芋艿:需要改下,金额是 bigdecimal | ||||
|     /** | ||||
|      * 数量是个特别“抽象”的概念,在不同排行下,代表不同含义 | ||||
|      * <p> | ||||
|      * | ||||
|      * 1. 金额:合同金额排行、回款金额排行 | ||||
|      * 2. 个数:签约合同排行、产品销量排行、产品销量排行、新增客户数排行、新增联系人排行、跟进次数排行、跟进客户数排行 | ||||
|      * | ||||
|      * 为什么使用 BigDecimal 的原因: | ||||
|      */ | ||||
|     @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||||
|     private Integer count; | ||||
|     private BigDecimal count; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -12,8 +12,7 @@ | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|     </select> | ||||
|  | ||||
| @@ -27,8 +26,7 @@ | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND return_time between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         AND return_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|     </select> | ||||
|  | ||||
| @@ -42,25 +40,23 @@ | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|     </select> | ||||
|  | ||||
|     <!-- TODO 待定 这里是否需要关联 crm_contract_product 表,计算销售额 --> | ||||
|     <select id="selectProductSalesRank" | ||||
|             resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | ||||
|         SELECT COUNT(1) AS count, owner_user_id | ||||
|         FROM crm_contract | ||||
|         WHERE deleted = 0 | ||||
|         AND audit_status = 20 | ||||
|         AND owner_user_id in | ||||
|         SELECT COUNT(product.count) AS count, contract.owner_user_id | ||||
|         FROM crm_contract_product product | ||||
|         INNER JOIN crm_contract contract ON product.contract_id = contract.id | ||||
|         WHERE contract.deleted = 0 AND contract.deleted = 0 | ||||
|         AND contract.audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | ||||
|         AND contract.owner_user_id in | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|         AND contract.order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY contract.owner_user_id | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectCustomerCountRank" | ||||
| @@ -72,8 +68,7 @@ | ||||
|             <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 create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|     </select> | ||||
|  | ||||
| @@ -86,8 +81,7 @@ | ||||
|             <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 create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY owner_user_id | ||||
|     </select> | ||||
|  | ||||
| @@ -102,8 +96,7 @@ | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY cc.owner_user_id | ||||
|     </select> | ||||
|  | ||||
| @@ -118,8 +111,7 @@ | ||||
|             <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | ||||
|                 #{userId} | ||||
|             </foreach> | ||||
|         AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and | ||||
|             #{times[1],javaType=java.time.LocalDateTime} | ||||
|         AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | ||||
|         GROUP BY cc.owner_user_id | ||||
|     </select> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV