diff --git a/pom.xml b/pom.xml
index 89807a7d00..5cf738c52c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
yudao-module-system
yudao-module-infra
-
+ yudao-module-bpm
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.http b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.http
deleted file mode 100644
index 23acfee920..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.http
+++ /dev/null
@@ -1,9 +0,0 @@
-### 合同金额排行榜
-GET {{baseUrl}}/crm/bi-ranking/contract-ranKing
-Authorization: Bearer {{token}}
-tenant-id: {{adminTenentId}}
-
-### 回款金额排行榜
-GET {{baseUrl}}/crm/bi-ranking/receivables-ranKing
-Authorization: Bearer {{token}}
-tenant-id: {{adminTenentId}}
\ No newline at end of file
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.java
deleted file mode 100644
index 2af4f23fad..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/BiRankingController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.bi;
-
-
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
-import cn.iocoder.yudao.module.crm.service.bi.BiRankingService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-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 = "管理后台 - 排行榜")
-@RestController
-@RequestMapping("/crm/bi-ranking")
-@Validated
-public class BiRankingController {
-
- @Resource
- private BiRankingService biRankingService;
-
- /**
- * 合同金额排行榜
- */
- @GetMapping("/contract-ranking")
- @Operation(summary = "合同金额排行榜")
- @PreAuthorize("@ss.hasPermission('bi:ranking:query')")
- public CommonResult> contractAmountRanking(BiRankingReqVO biRankingReqVO) {
- return success(biRankingService.contractRanKing(biRankingReqVO));
- }
-
- /**
- * 回款金额排行榜
- */
- @GetMapping("/receivables-ranking")
- @Operation(summary = "回款金额排行榜")
- @PreAuthorize("@ss.hasPermission('bi:ranking:query')")
- public CommonResult> receivablesRanKing(BiRankingReqVO biRankingReqVO) {
- return success(biRankingService.receivablesRanKing(biRankingReqVO));
- }
-
-}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.http b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.http
new file mode 100644
index 0000000000..b9e9a4edf8
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.http
@@ -0,0 +1,9 @@
+### 合同金额排行榜
+GET {{baseUrl}}/crm/bi-rank/get-contract-price-rank?deptId=100×[0]=2022-12-12 00:00:00×[1]=2024-12-12 23:59:59
+Authorization: Bearer {{token}}
+tenant-id: {{adminTenentId}}
+
+### 回款金额排行榜
+GET {{baseUrl}}/crm/bi-rank/get-receivable-price-rank?deptId=100×[0]=2022-12-12 00:00:00×[1]=2024-12-12 23:59:59
+Authorization: Bearer {{token}}
+tenant-id: {{adminTenentId}}
\ No newline at end of file
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.java
new file mode 100644
index 0000000000..a188232ef3
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/CrmBiRankController.java
@@ -0,0 +1,45 @@
+package cn.iocoder.yudao.module.crm.controller.admin.bi;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
+import cn.iocoder.yudao.module.crm.service.bi.CrmBiRankingService;
+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 BI 排行榜")
+@RestController
+@RequestMapping("/crm/bi-rank")
+@Validated
+public class CrmBiRankController {
+
+ @Resource
+ private CrmBiRankingService rankingService;
+
+ @GetMapping("/get-contract-price-rank")
+ @Operation(summary = "获得合同金额排行榜")
+ @PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
+ public CommonResult> getContractPriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
+ return success(rankingService.getContractPriceRank(rankingReqVO));
+ }
+
+ @GetMapping("/get-receivable-price-rank")
+ @Operation(summary = "获得回款金额排行榜")
+ @PreAuthorize("@ss.hasPermission('crm:bi-rank:query')")
+ public CommonResult> getReceivablePriceRank(@Valid CrmBiRankReqVO rankingReqVO) {
+ return success(rankingService.getReceivablePriceRank(rankingReqVO));
+ }
+
+}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiParams.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiParams.java
deleted file mode 100644
index 0dee1c0926..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiParams.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-// TODO @anhaohao:这个类的命名,还是保持和其它一致使用 ReqVO 结尾;例如说,CrmStatisticsCommonParamReqVO
-/**
- * @author anhaohao
- * bi参数
- */
-@EqualsAndHashCode(callSuper = true)
-@Schema(description = "bi查询相关参数")
-@Data
-public class BiParams extends PageParam {
-
- @Schema(description = "部门ID")
- private Long deptId;
-
- @Schema(description = "用户ID")
- private Long userId;
-
- // TODO @anhaohao:这个字段,可以融合到 startTime、endTime 里去,交给前端计算哈;
- @Schema(description = "类型")
- private String type;
-
- // TODO @anhaohao:还是使用 LocalDateTime
- @Schema(description = "开始时间")
- private String startTime;
-
- @Schema(description = "结束时间")
- private String endTime;
-
-}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRankingReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRankingReqVO.java
deleted file mode 100644
index 06b013333a..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRankingReqVO.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-/**
- * 管理后台 - 排行榜 Request VO
- *
- * @author anhaohao
- */
-@Schema(description = "管理后台 - 排行榜 Request VO")
-@Data
-public class BiRankingReqVO {
-
- @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Long deptId;
-
- @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-12-12 00:00:00")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime startTime;
-
- @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2023-12-12 23:59:59")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime endTime;
-
- @Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1")
- private List userIds;
-
-}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRanKingRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRanKRespVO.java
similarity index 51%
rename from yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRanKingRespVO.java
rename to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRanKRespVO.java
index 8aef25b965..404ee33520 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/BiRanKingRespVO.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRanKRespVO.java
@@ -4,12 +4,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-@Schema(description = "管理后台 - BI 排行榜 Response VO")
+@Schema(description = "管理后台 - CRM BI 排行榜 Response VO")
@Data
-public class BiRanKingRespVO {
+public class CrmBiRanKRespVO {
- @Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer price;
+ @Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+ private Long ownerUserId;
@Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private String nickname;
@@ -17,7 +17,13 @@ public class BiRanKingRespVO {
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private String deptName;
- @Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Long ownerUserId;
+ /**
+ * 数量是个特别“抽象”的概念,在不同排行下,代表不同含义
+ *
+ * 1. 金额:合同金额排行、回款金额排行
+ * 2. 个数:签约合同排行、产品销量排行、产品销量排行、新增客户数排行、新增联系人排行、跟进次数排行、跟进客户数排行
+ */
+ @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+ private Integer count;
}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRankReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRankReqVO.java
new file mode 100644
index 0000000000..6d36f6d6f7
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/bi/vo/CrmBiRankReqVO.java
@@ -0,0 +1,35 @@
+package cn.iocoder.yudao.module.crm.controller.admin.bi.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - CRM BI 排行榜 Request VO")
+@Data
+public class CrmBiRankReqVO {
+
+ @Schema(description = "部门 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+ @NotNull(message = "部门 id 不能为空")
+ private Long deptId;
+
+ /**
+ * userIds 目前不用前端传递,目前是方便后端通过 deptId 读取编号后,设置回来
+ *
+ * 后续,可能会支持选择部分用户进行查询
+ */
+ @Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2")
+ private List userIds;
+
+ @Schema(description = "时间范围", requiredMode = Schema.RequiredMode.REQUIRED)
+ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+ @NotEmpty(message = "时间范围不能为空")
+ private LocalDateTime[] times;
+
+}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
index b259e7bad8..328695b8bc 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
@@ -45,7 +45,6 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
public class CrmContractController {
@Resource
- @Lazy
private CrmContractService contractService;
@Resource
private CrmCustomerService customerService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
index 020b84c56b..8516ebd661 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
@@ -26,7 +26,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
-import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -52,7 +51,6 @@ public class CrmReceivableController {
@Resource
private CrmReceivableService receivableService;
@Resource
- @Lazy
private CrmContractService contractService;
@Resource
private CrmCustomerService customerService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/BiRankingMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/BiRankingMapper.java
deleted file mode 100644
index a35e80777d..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/BiRankingMapper.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.iocoder.yudao.module.crm.dal.mysql.bi;
-
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @author anhaohao
- */
-@Mapper
-public interface BiRankingMapper extends BaseMapperX {
- /**
- * 合同金额排行榜
- *
- * @param biRankingReqVO 参数
- * @return List
- */
- List contractRanKing(BiRankingReqVO biRankingReqVO);
-
-
- /**
- * 回款金额排行榜
- *
- * @param biRankingReqVO 参数
- * @return List
- */
- List receivablesRanKing(BiRankingReqVO biRankingReqVO);
-}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/CrmBiRankingMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/CrmBiRankingMapper.java
new file mode 100644
index 0000000000..91b7a191be
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/bi/CrmBiRankingMapper.java
@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.crm.dal.mysql.bi;
+
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * CRM BI 排行榜 Mapper
+ *
+ * @author anhaohao
+ */
+@Mapper
+public interface CrmBiRankingMapper {
+
+ /**
+ * 查询合同金额排行榜
+ *
+ * @param rankReqVO 参数
+ * @return 合同金额排行榜
+ */
+ List selectContractPriceRank(CrmBiRankReqVO rankReqVO);
+
+ /**
+ * 查询回款金额排行榜
+ *
+ * @param rankReqVO 参数
+ * @return 回款金额排行榜
+ */
+ List selectReceivablePriceRank(CrmBiRankReqVO rankReqVO);
+
+}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
index 812417bf28..d3c58522e9 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
import com.mzt.logapi.service.IParseFunction;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
/**
@@ -21,7 +20,6 @@ public class CrmContractParseFunction implements IParseFunction {
public static final String NAME = "getContractById";
@Resource
- @Lazy
private CrmContractService contractService;
@Override
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingService.java
deleted file mode 100644
index 17c9722de6..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.iocoder.yudao.module.crm.service.bi;
-
-
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
-
-import java.util.List;
-
-/**
- * BI 排行榜 Service 接口
- *
- * @author anhaohao
- */
-public interface BiRankingService {
-
- /**
- * 合同金额排行榜
- *
- * @param biRankingReqVO 参数
- * @return List
- */
- List contractRanKing(BiRankingReqVO biRankingReqVO);
-
- /**
- * 回款金额排行榜
- *
- * @param biRankingReqVO 参数
- * @return List
- */
- List receivablesRanKing(BiRankingReqVO biRankingReqVO);
-}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingServiceImpl.java
deleted file mode 100644
index 9a65340671..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/BiRankingServiceImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package cn.iocoder.yudao.module.crm.service.bi;
-
-import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
-
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRanKingRespVO;
-import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.BiRankingReqVO;
-import cn.iocoder.yudao.module.crm.dal.mysql.bi.BiRankingMapper;
-import cn.iocoder.yudao.module.system.api.dept.DeptApi;
-import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
-import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
-import jakarta.annotation.Resource;
-import org.springframework.stereotype.Service;
-import org.springframework.validation.annotation.Validated;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-@Service(value = "biRankingService")
-@Validated
-public class BiRankingServiceImpl implements BiRankingService {
-
- @Resource
- private BiRankingMapper biRankingMapper;
- @Resource
- private AdminUserApi adminUserApi;
- @Resource
- private DeptApi deptApi;
-
- @Override
- public List contractRanKing(BiRankingReqVO biRankingReqVO) {
- return processRanking(biRankingReqVO, biRankingMapper::contractRanKing);
- }
-
- @Override
- public List receivablesRanKing(BiRankingReqVO biRankingReqVO) {
- return processRanking(biRankingReqVO, biRankingMapper::receivablesRanKing);
- }
-
- /**
- * 处理排行榜
- *
- * @param biRankingReqVO 参数
- * @param rankingFunction 排行榜方法
- * @return List
- */
- private List processRanking(BiRankingReqVO biRankingReqVO, Function> rankingFunction) {
- analyzeAuth(biRankingReqVO);
- if (biRankingReqVO.getUserIds().isEmpty()) {
- return new ArrayList<>();
- }
- List biRanKingRespVOS = rankingFunction.apply(biRankingReqVO);
- return setName(biRanKingRespVOS);
- }
-
- /**
- * 设置用户名称
- *
- * @param biRanKingRespVOS 排行榜数据
- * @return List
- */
- private List setName(List biRanKingRespVOS) {
- List userIds = biRanKingRespVOS.stream().map(BiRanKingRespVO::getOwnerUserId).collect(Collectors.toList());
- Map userMap = adminUserApi.getUserMap(userIds);
- Map deptMap = deptApi.getDeptMap(userMap.values().stream().map(AdminUserRespDTO::getDeptId).collect(Collectors.toList()));
- for (BiRanKingRespVO biRanKingRespVO : biRanKingRespVOS) {
- AdminUserRespDTO adminUserRespDTO = userMap.get(biRanKingRespVO.getOwnerUserId());
- if (adminUserRespDTO != null) {
- biRanKingRespVO.setNickname(adminUserRespDTO.getNickname());
- DeptRespDTO deptRespDTO = deptMap.get(adminUserRespDTO.getDeptId());
- if (deptRespDTO != null) {
- biRanKingRespVO.setDeptName(deptRespDTO.getName());
- }
- }
- }
- return biRanKingRespVOS;
- }
-
- /**
- * 分析权限
- *
- * @param biRankingReqVO 参数
- */
- public void analyzeAuth(BiRankingReqVO biRankingReqVO) {
- Long deptId = biRankingReqVO.getDeptId() == null ? adminUserApi.getUser(SecurityFrameworkUtils.getLoginUserId()).getDeptId() : biRankingReqVO.getDeptId();
- List deptIds = deptApi.getChildDeptList(deptId).stream().map(DeptRespDTO::getId).collect(Collectors.toList());
- deptIds.add(deptId);
- biRankingReqVO.setUserIds(adminUserApi.getUserListByDeptIds(deptIds).stream().map(AdminUserRespDTO::getId).collect(Collectors.toList()));
- }
-}
\ No newline at end of file
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingService.java
new file mode 100644
index 0000000000..72d1d6f97b
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingService.java
@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.module.crm.service.bi;
+
+
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
+
+import java.util.List;
+
+/**
+ * CRM BI 排行榜 Service 接口
+ *
+ * @author anhaohao
+ */
+public interface CrmBiRankingService {
+
+ /**
+ * 获得合同金额排行榜
+ *
+ * @param rankReqVO 排行参数
+ * @return 合同金额排行榜
+ */
+ List getContractPriceRank(CrmBiRankReqVO rankReqVO);
+
+ /**
+ * 获得回款金额排行榜
+ *
+ * @param rankReqVO 排行参数
+ * @return 回款金额排行榜
+ */
+ List getReceivablePriceRank(CrmBiRankReqVO rankReqVO);
+
+}
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingServiceImpl.java
new file mode 100644
index 0000000000..84f47ddc90
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/bi/CrmBiRankingServiceImpl.java
@@ -0,0 +1,104 @@
+package cn.iocoder.yudao.module.crm.service.bi;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRanKRespVO;
+import cn.iocoder.yudao.module.crm.controller.admin.bi.vo.CrmBiRankReqVO;
+import cn.iocoder.yudao.module.crm.dal.mysql.bi.CrmBiRankingMapper;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
+
+/**
+ * CRM BI 排行榜 Service 实现类
+ *
+ * @author anhaohao
+ */
+@Service
+@Validated
+public class CrmBiRankingServiceImpl implements CrmBiRankingService {
+
+ @Resource
+ private CrmBiRankingMapper biRankingMapper;
+
+ @Resource
+ private AdminUserApi adminUserApi;
+ @Resource
+ private DeptApi deptApi;
+
+ @Override
+ public List getContractPriceRank(CrmBiRankReqVO rankReqVO) {
+ return getRank(rankReqVO, biRankingMapper::selectContractPriceRank);
+ }
+
+ @Override
+ public List getReceivablePriceRank(CrmBiRankReqVO rankReqVO) {
+ return getRank(rankReqVO, biRankingMapper::selectReceivablePriceRank);
+ }
+
+ /**
+ * 获得排行版数据
+ *
+ * @param rankReqVO 参数
+ * @param rankFunction 排行榜方法
+ * @return 排行版数据
+ */
+ private List getRank(CrmBiRankReqVO rankReqVO, Function> rankFunction) {
+ // 1. 获得用户编号数组
+ rankReqVO.setUserIds(getUserIds(rankReqVO.getDeptId()));
+ if (CollUtil.isEmpty(rankReqVO.getUserIds())) {
+ return Collections.emptyList();
+ }
+ // 2. 获得排行数据
+ List ranks = rankFunction.apply(rankReqVO);
+ if (CollUtil.isEmpty(ranks)) {
+ return Collections.emptyList();
+ }
+ ranks.sort(Comparator.comparing(CrmBiRanKRespVO::getCount).reversed());
+ // 3. 拼接用户信息
+ appendUserInfo(ranks);
+ return ranks;
+ }
+
+ /**
+ * 拼接用户信息(昵称、部门)
+ *
+ * @param ranks 排行榜数据
+ */
+ private void appendUserInfo(List ranks) {
+ Map userMap = adminUserApi.getUserMap(convertSet(ranks, CrmBiRanKRespVO::getOwnerUserId));
+ Map deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
+ ranks.forEach(rank -> MapUtils.findAndThen(userMap, rank.getOwnerUserId(), user -> {
+ rank.setNickname(user.getNickname());
+ MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> rank.setDeptName(dept.getName()));
+ }));
+ }
+
+ /**
+ * 获得部门下的用户编号数组,包括子部门的
+ *
+ * @param deptId 部门编号
+ * @return 用户编号数组
+ */
+ public List getUserIds(Long deptId) {
+ // 1. 获得部门列表
+ List deptIds = convertList(deptApi.getChildDeptList(deptId), DeptRespDTO::getId);
+ deptIds.add(deptId);
+ // 2. 获得用户编号
+ return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId);
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
index 8779714353..aa0839d12a 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
@@ -57,7 +57,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
@Resource
private CrmBusinessProductService businessProductService;
@Resource
- @Lazy
+ @Lazy // 延迟加载,避免循环依赖
private CrmContractService contractService;
@Resource
private CrmPermissionService permissionService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
index 4c1a7fd959..52f2d6cf74 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
@@ -25,7 +25,6 @@ import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.service.impl.DiffParseFunction;
import com.mzt.logapi.starter.annotation.LogRecord;
import jakarta.annotation.Resource;
-import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@@ -57,7 +56,6 @@ public class CrmContactServiceImpl implements CrmContactService {
@Resource
private CrmPermissionService permissionService;
@Resource
- @Lazy
private CrmContractService contractService;
@Resource
private CrmContactBusinessService contactBusinessService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
index c4008590cf..9ac2e7f431 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
@@ -50,7 +50,6 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
private CrmReceivablePlanMapper receivablePlanMapper;
@Resource
- @Lazy
private CrmContractService contractService;
@Resource
private CrmCustomerService customerService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
index b0777787f0..effe0d7206 100644
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
@@ -51,7 +51,6 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
private CrmReceivableMapper receivableMapper;
@Resource
- @Lazy
private CrmContractService contractService;
@Resource
private CrmCustomerService customerService;
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/BiRankingMapper.xml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/BiRankingMapper.xml
deleted file mode 100644
index 9ebcbda0eb..0000000000
--- a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/BiRankingMapper.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/CrmBiRankingMapper.xml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/CrmBiRankingMapper.xml
new file mode 100644
index 0000000000..ef90bb564c
--- /dev/null
+++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/bi/CrmBiRankingMapper.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java
index 54aaa4dc7c..c26acb8ca1 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java
@@ -44,6 +44,9 @@ public class AuthPermissionInfoRespVO {
@Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.jpg")
private String avatar;
+ @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
+ private Long deptId;
+
}
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java
index 8343547d9e..18463e7f66 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.convert.auth;
import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
@@ -29,7 +30,7 @@ public interface AuthConvert {
default AuthPermissionInfoRespVO convert(AdminUserDO user, List roleList, List menuList) {
return AuthPermissionInfoRespVO.builder()
- .user(AuthPermissionInfoRespVO.UserVO.builder().id(user.getId()).nickname(user.getNickname()).avatar(user.getAvatar()).build())
+ .user(BeanUtils.toBean(user, AuthPermissionInfoRespVO.UserVO.class))
.roles(convertSet(roleList, RoleDO::getCode))
// 权限标识信息
.permissions(convertSet(menuList, MenuDO::getPermission))
diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml
index 7c288f725b..ff17b298d3 100644
--- a/yudao-server/pom.xml
+++ b/yudao-server/pom.xml
@@ -46,11 +46,11 @@
-
-
-
-
-
+
+ cn.iocoder.boot
+ yudao-module-bpm-biz
+ ${revision}
+