Commit e3ab3895b71aeeb28a3797ebc6dd6d07c12b03f8
1 parent
13da7eba
reactor:移除 crm 的 api 包
Showing
303 changed files
with
3282 additions
and
3347 deletions
yudao-module-crm/pom.xml
| ... | ... | @@ -7,13 +7,9 @@ |
| 7 | 7 | <artifactId>yudao</artifactId> |
| 8 | 8 | <version>${revision}</version> |
| 9 | 9 | </parent> |
| 10 | - <modules> | |
| 11 | - <module>yudao-module-crm-api</module> | |
| 12 | - <module>yudao-module-crm-biz</module> | |
| 13 | - </modules> | |
| 14 | 10 | <modelVersion>4.0.0</modelVersion> |
| 15 | 11 | <artifactId>yudao-module-crm</artifactId> |
| 16 | - <packaging>pom</packaging> | |
| 12 | + <packaging>jar</packaging> | |
| 17 | 13 | |
| 18 | 14 | <name>${project.artifactId}</name> |
| 19 | 15 | <description> |
| ... | ... | @@ -21,4 +17,60 @@ |
| 21 | 17 | 例如说:客户、联系人、商机、合同、回款等等 |
| 22 | 18 | </description> |
| 23 | 19 | |
| 20 | + <dependencies> | |
| 21 | + <dependency> | |
| 22 | + <groupId>cn.iocoder.boot</groupId> | |
| 23 | + <artifactId>yudao-module-system</artifactId> | |
| 24 | + <version>${revision}</version> | |
| 25 | + </dependency> | |
| 26 | + <dependency> | |
| 27 | + <groupId>cn.iocoder.boot</groupId> | |
| 28 | + <artifactId>yudao-module-infra</artifactId> | |
| 29 | + <version>${revision}</version> | |
| 30 | + </dependency> | |
| 31 | + <dependency> | |
| 32 | + <groupId>cn.iocoder.boot</groupId> | |
| 33 | + <artifactId>yudao-module-bpm</artifactId> | |
| 34 | + <version>${revision}</version> | |
| 35 | + </dependency> | |
| 36 | + | |
| 37 | + <!-- 业务组件 --> | |
| 38 | + <dependency> | |
| 39 | + <groupId>cn.iocoder.boot</groupId> | |
| 40 | + <artifactId>yudao-spring-boot-starter-biz-ip</artifactId> | |
| 41 | + </dependency> | |
| 42 | + <dependency> | |
| 43 | + <groupId>cn.iocoder.boot</groupId> | |
| 44 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 45 | + </dependency> | |
| 46 | + | |
| 47 | + <!-- Web 相关 --> | |
| 48 | + <dependency> | |
| 49 | + <groupId>cn.iocoder.boot</groupId> | |
| 50 | + <artifactId>yudao-spring-boot-starter-web</artifactId> | |
| 51 | + </dependency> | |
| 52 | + | |
| 53 | + <dependency> | |
| 54 | + <groupId>cn.iocoder.boot</groupId> | |
| 55 | + <artifactId>yudao-spring-boot-starter-security</artifactId> | |
| 56 | + </dependency> | |
| 57 | + | |
| 58 | + <!-- DB 相关 --> | |
| 59 | + <dependency> | |
| 60 | + <groupId>cn.iocoder.boot</groupId> | |
| 61 | + <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | |
| 62 | + </dependency> | |
| 63 | + | |
| 64 | + <!-- 工具类相关 --> | |
| 65 | + <dependency> | |
| 66 | + <groupId>cn.iocoder.boot</groupId> | |
| 67 | + <artifactId>yudao-spring-boot-starter-excel</artifactId> | |
| 68 | + </dependency> | |
| 69 | + | |
| 70 | + <!-- Test 测试相关 --> | |
| 71 | + <dependency> | |
| 72 | + <groupId>cn.iocoder.boot</groupId> | |
| 73 | + <artifactId>yudao-spring-boot-starter-test</artifactId> | |
| 74 | + </dependency> | |
| 75 | + </dependencies> | |
| 24 | 76 | </project> | ... | ... |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/api/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/api/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessTransferReqVO.java renamed to yudao-module-crm/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/business/vo/business/CrmBusinessUpdateStatusReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessUpdateStatusReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/CrmClueController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/CrmClueController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmCluePageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueTransferReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueTransferReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusiness2ReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusiness2ReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusinessReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactBusinessReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java renamed to yudao-module-crm/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/CrmContractConfigController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractConfigController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/config/CrmContractConfigRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/config/CrmContractConfigRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/config/CrmContractConfigSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/config/CrmContractConfigSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractTransferReqVO.java renamed to yudao-module-crm/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/CrmCustomerController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerLimitConfigController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerLimitConfigController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerDistributeReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerDistributeReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportExcelVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportExcelVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerImportRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerLockReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerLockReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerTransferReqVO.java renamed to yudao-module-crm/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/customer/vo/limitconfig/CrmCustomerLimitConfigPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/limitconfig/CrmCustomerLimitConfigSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/poolconfig/CrmCustomerPoolConfigSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/CrmOperateLogController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/CrmOperateLogController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/vo/CrmOperateLogPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/vo/CrmOperateLogPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/vo/CrmOperateLogRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/operatelog/vo/CrmOperateLogRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/CrmPermissionController.http renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/CrmPermissionController.http
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/CrmPermissionController.java renamed to yudao-module-crm/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/controller/admin/permission/vo/CrmPermissionRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/vo/CrmPermissionRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/vo/CrmPermissionSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/vo/CrmPermissionSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/vo/CrmPermissionUpdateReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/vo/CrmPermissionUpdateReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductCategoryController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductCategoryController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryCreateReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryCreateReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryListReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryListReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/category/CrmProductCategoryRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/vo/product/CrmProductSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsCustomerController.http renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsCustomerController.http
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsCustomerController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsCustomerController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsFunnelController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsFunnelController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsPerformanceController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsPerformanceController.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.statistics; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.service.statistics.CrmStatisticsPerformanceService; | |
| 7 | -import io.swagger.v3.oas.annotations.Operation; | |
| 8 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 10 | -import org.springframework.validation.annotation.Validated; | |
| 11 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | -import org.springframework.web.bind.annotation.RestController; | |
| 14 | - | |
| 15 | -import jakarta.annotation.Resource; | |
| 16 | -import jakarta.validation.Valid; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | - | |
| 22 | -@Tag(name = "管理后台 - CRM 员工业绩统计") | |
| 23 | -@RestController | |
| 24 | -@RequestMapping("/crm/statistics-performance") | |
| 25 | -@Validated | |
| 26 | -public class CrmStatisticsPerformanceController { | |
| 27 | - | |
| 28 | - @Resource | |
| 29 | - private CrmStatisticsPerformanceService performanceService; | |
| 30 | - | |
| 31 | - @GetMapping("/get-contract-count-performance") | |
| 32 | - @Operation(summary = "合同数量统计", description = "用于【合同数量分析】页面") | |
| 33 | - @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 34 | - public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractCountPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 35 | - return success(performanceService.getContractCountPerformance(performanceReqVO)); | |
| 36 | - } | |
| 37 | - | |
| 38 | - @GetMapping("/get-contract-price-performance") | |
| 39 | - @Operation(summary = "合同金额统计") | |
| 40 | - @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 41 | - public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractPriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 42 | - return success(performanceService.getContractPricePerformance(performanceReqVO)); | |
| 43 | - } | |
| 44 | - | |
| 45 | - @GetMapping("/get-receivable-price-performance") | |
| 46 | - @Operation(summary = "回款金额统计") | |
| 47 | - @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 48 | - public CommonResult<List<CrmStatisticsPerformanceRespVO>> getReceivablePriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 49 | - return success(performanceService.getReceivablePricePerformance(performanceReqVO)); | |
| 50 | - } | |
| 51 | - | |
| 52 | -} | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.statistics; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.service.statistics.CrmStatisticsPerformanceService; | |
| 7 | +import io.swagger.v3.oas.annotations.Operation; | |
| 8 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 10 | +import org.springframework.validation.annotation.Validated; | |
| 11 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | +import org.springframework.web.bind.annotation.RestController; | |
| 14 | + | |
| 15 | +import jakarta.annotation.Resource; | |
| 16 | +import jakarta.validation.Valid; | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | + | |
| 21 | + | |
| 22 | +@Tag(name = "管理后台 - CRM 员工业绩统计") | |
| 23 | +@RestController | |
| 24 | +@RequestMapping("/crm/statistics-performance") | |
| 25 | +@Validated | |
| 26 | +public class CrmStatisticsPerformanceController { | |
| 27 | + | |
| 28 | + @Resource | |
| 29 | + private CrmStatisticsPerformanceService performanceService; | |
| 30 | + | |
| 31 | + @GetMapping("/get-contract-count-performance") | |
| 32 | + @Operation(summary = "合同数量统计", description = "用于【合同数量分析】页面") | |
| 33 | + @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 34 | + public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractCountPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 35 | + return success(performanceService.getContractCountPerformance(performanceReqVO)); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @GetMapping("/get-contract-price-performance") | |
| 39 | + @Operation(summary = "合同金额统计") | |
| 40 | + @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 41 | + public CommonResult<List<CrmStatisticsPerformanceRespVO>> getContractPriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 42 | + return success(performanceService.getContractPricePerformance(performanceReqVO)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @GetMapping("/get-receivable-price-performance") | |
| 46 | + @Operation(summary = "回款金额统计") | |
| 47 | + @PreAuthorize("@ss.hasPermission('crm:statistics-performance:query')") | |
| 48 | + public CommonResult<List<CrmStatisticsPerformanceRespVO>> getReceivablePriceStaffPerformance(@Valid CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 49 | + return success(performanceService.getReceivablePricePerformance(performanceReqVO)); | |
| 50 | + } | |
| 51 | + | |
| 52 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsPortraitController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsPortraitController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsRankController.http renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsRankController.http
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsRankController.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/CrmStatisticsRankController.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerByUserBaseRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerByUserBaseRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerContractSummaryRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerContractSummaryRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByAreaRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByAreaRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByProductRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByProductRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByUserRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerDealCycleByUserRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerSummaryByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerSummaryByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerSummaryByUserRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsCustomerSummaryByUserRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByTypeRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByTypeRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByUserRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsFollowUpSummaryByUserRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsPoolSummaryByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsPoolSummaryByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsPoolSummaryByUserRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/customer/CrmStatisticsPoolSummaryByUserRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticFunnelSummaryRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticFunnelSummaryRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessInversionRateSummaryByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessInversionRateSummaryByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessSummaryByDateRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessSummaryByDateRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessSummaryByEndStatusRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsBusinessSummaryByEndStatusRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsFunnelReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/funnel/CrmStatisticsFunnelReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/performance/CrmStatisticsPerformanceReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/performance/CrmStatisticsPerformanceReqVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | - | |
| 7 | -import jakarta.validation.constraints.NotEmpty; | |
| 8 | -import jakarta.validation.constraints.NotNull; | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | - | |
| 14 | -@Schema(description = "管理后台 - CRM 员工业绩统计 Request VO") | |
| 15 | -@Data | |
| 16 | -public class CrmStatisticsPerformanceReqVO { | |
| 17 | - | |
| 18 | - @Schema(description = "部门 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 19 | - @NotNull(message = "部门 id 不能为空") | |
| 20 | - private Long deptId; | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 负责人用户 id, 当用户为空, 则计算部门下用户 | |
| 24 | - */ | |
| 25 | - @Schema(description = "负责人用户 id", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1") | |
| 26 | - private Long userId; | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * userIds 目前不用前端传递,目前是方便后端通过 deptId 读取编号后,设置回来 | |
| 30 | - * <p> | |
| 31 | - * 后续,可能会支持选择部分用户进行查询 | |
| 32 | - */ | |
| 33 | - @Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2") | |
| 34 | - private List<Long> userIds; | |
| 35 | - | |
| 36 | - @Schema(description = "时间范围", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 37 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 38 | - @NotEmpty(message = "时间范围不能为空") | |
| 39 | - private LocalDateTime[] times; | |
| 40 | - | |
| 41 | -} | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | + | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - CRM 员工业绩统计 Request VO") | |
| 15 | +@Data | |
| 16 | +public class CrmStatisticsPerformanceReqVO { | |
| 17 | + | |
| 18 | + @Schema(description = "部门 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 19 | + @NotNull(message = "部门 id 不能为空") | |
| 20 | + private Long deptId; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 负责人用户 id, 当用户为空, 则计算部门下用户 | |
| 24 | + */ | |
| 25 | + @Schema(description = "负责人用户 id", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1") | |
| 26 | + private Long userId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * userIds 目前不用前端传递,目前是方便后端通过 deptId 读取编号后,设置回来 | |
| 30 | + * <p> | |
| 31 | + * 后续,可能会支持选择部分用户进行查询 | |
| 32 | + */ | |
| 33 | + @Schema(description = "负责人用户 id 集合", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2") | |
| 34 | + private List<Long> userIds; | |
| 35 | + | |
| 36 | + @Schema(description = "时间范围", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 38 | + @NotEmpty(message = "时间范围不能为空") | |
| 39 | + private LocalDateTime[] times; | |
| 40 | + | |
| 41 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/performance/CrmStatisticsPerformanceRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/performance/CrmStatisticsPerformanceRespVO.java
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | -import java.math.BigDecimal; | |
| 6 | - | |
| 7 | - | |
| 8 | -@Schema(description = "管理后台 - CRM 员工业绩统计 Response VO") | |
| 9 | -@Data | |
| 10 | -public class CrmStatisticsPerformanceRespVO { | |
| 11 | - | |
| 12 | - @Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401") | |
| 13 | - private String time; | |
| 14 | - | |
| 15 | - @Schema(description = "当月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 16 | - private BigDecimal currentMonthCount; | |
| 17 | - | |
| 18 | - @Schema(description = "上月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 19 | - private BigDecimal lastMonthCount; | |
| 20 | - | |
| 21 | - @Schema(description = "去年同期统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") | |
| 22 | - private BigDecimal lastYearCount; | |
| 23 | - | |
| 24 | -} | |
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import java.math.BigDecimal; | |
| 6 | + | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 员工业绩统计 Response VO") | |
| 9 | +@Data | |
| 10 | +public class CrmStatisticsPerformanceRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "时间轴", requiredMode = Schema.RequiredMode.REQUIRED, example = "202401") | |
| 13 | + private String time; | |
| 14 | + | |
| 15 | + @Schema(description = "当月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 16 | + private BigDecimal currentMonthCount; | |
| 17 | + | |
| 18 | + @Schema(description = "上月统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 19 | + private BigDecimal lastMonthCount; | |
| 20 | + | |
| 21 | + @Schema(description = "去年同期统计结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") | |
| 22 | + private BigDecimal lastYearCount; | |
| 23 | + | |
| 24 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerAreaRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerAreaRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerIndustryRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerIndustryRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerLevelRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerLevelRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerSourceRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticCustomerSourceRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticsPortraitReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/portrait/CrmStatisticsPortraitReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/rank/CrmStatisticsRankReqVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/rank/CrmStatisticsRankReqVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/rank/CrmStatisticsRankRespVO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/statistics/vo/rank/CrmStatisticsRankRespVO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/app/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/app/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/convert/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessProductDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessProductDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/clue/CrmClueDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/clue/CrmClueDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/clue/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/clue/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/CrmContactBusinessDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/CrmContactBusinessDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/CrmContactDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/CrmContactDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contact/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractConfigDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractConfigDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerLimitConfigDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerLimitConfigDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerPoolConfigDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerPoolConfigDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/permission/CrmPermissionDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/CrmProductCategoryDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/CrmProductCategoryDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/CrmProductDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/CrmProductDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/product/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivablePlanDO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivablePlanDO.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessProductMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessProductMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactBusinessMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactBusinessMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractConfigMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractConfigMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractProductMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractProductMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerLimitConfigMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerLimitConfigMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerPoolConfigMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerPoolConfigMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/followup/CrmFollowUpRecordMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/followup/CrmFollowUpRecordMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/product/CrmProductCategoryMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/product/CrmProductCategoryMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/product/CrmProductMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/product/CrmProductMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsCustomerMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsCustomerMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsFunnelMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsFunnelMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsPerformanceMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsPerformanceMapper.java
| 1 | -package cn.iocoder.yudao.module.crm.dal.mysql.statistics; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 5 | -import org.apache.ibatis.annotations.Mapper; | |
| 6 | - | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * CRM 员工业绩分析 Mapper | |
| 11 | - * | |
| 12 | - * @author scholar | |
| 13 | - */ | |
| 14 | -@Mapper | |
| 15 | -public interface CrmStatisticsPerformanceMapper { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 员工签约合同数量 | |
| 19 | - * | |
| 20 | - * @param performanceReqVO 参数 | |
| 21 | - * @return 员工签约合同数量 | |
| 22 | - */ | |
| 23 | - List<CrmStatisticsPerformanceRespVO> selectContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 员工签约合同金额 | |
| 27 | - * | |
| 28 | - * @param performanceReqVO 参数 | |
| 29 | - * @return 员工签约合同金额 | |
| 30 | - */ | |
| 31 | - List<CrmStatisticsPerformanceRespVO> selectContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 员工回款金额 | |
| 35 | - * | |
| 36 | - * @param performanceReqVO 参数 | |
| 37 | - * @return 员工回款金额 | |
| 38 | - */ | |
| 39 | - List<CrmStatisticsPerformanceRespVO> selectReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 40 | - | |
| 41 | -} | |
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.statistics; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 5 | +import org.apache.ibatis.annotations.Mapper; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * CRM 员工业绩分析 Mapper | |
| 11 | + * | |
| 12 | + * @author scholar | |
| 13 | + */ | |
| 14 | +@Mapper | |
| 15 | +public interface CrmStatisticsPerformanceMapper { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 员工签约合同数量 | |
| 19 | + * | |
| 20 | + * @param performanceReqVO 参数 | |
| 21 | + * @return 员工签约合同数量 | |
| 22 | + */ | |
| 23 | + List<CrmStatisticsPerformanceRespVO> selectContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 员工签约合同金额 | |
| 27 | + * | |
| 28 | + * @param performanceReqVO 参数 | |
| 29 | + * @return 员工签约合同金额 | |
| 30 | + */ | |
| 31 | + List<CrmStatisticsPerformanceRespVO> selectContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 员工回款金额 | |
| 35 | + * | |
| 36 | + * @param performanceReqVO 参数 | |
| 37 | + * @return 员工回款金额 | |
| 38 | + */ | |
| 39 | + List<CrmStatisticsPerformanceRespVO> selectReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 40 | + | |
| 41 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsPortraitMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsPortraitMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsRankMapper.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/statistics/CrmStatisticsRankMapper.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/redis/RedisKeyConstants.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/redis/RedisKeyConstants.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/redis/no/CrmNoRedisDAO.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/redis/no/CrmNoRedisDAO.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/business/CrmBusinessEndStatusEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/business/CrmBusinessEndStatusEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmAuditStatusEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmAuditStatusEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmBizTypeEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmBizTypeEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/common/CrmSceneTypeEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLevelEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLevelEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLimitConfigTypeEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLimitConfigTypeEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/permission/CrmPermissionLevelEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/permission/CrmPermissionLevelEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/receivable/CrmReceivableReturnTypeEnum.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/enums/receivable/CrmReceivableReturnTypeEnum.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/excel/core/AreaExcelColumnSelectFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/excel/core/AreaExcelColumnSelectFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/excel/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/excel/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmBusinessParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmBusinessParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContactParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContactParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerIndustryParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerIndustryParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerLevelParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerLevelParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerSourceParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmCustomerSourceParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmProductStatusParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmProductStatusParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmProductUnitParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmProductUnitParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmReceivablePlanParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmReceivablePlanParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmReceivableReturnTypeParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmReceivableReturnTypeParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAdminUserParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAdminUserParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAreaParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysAreaParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysBooleanParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysBooleanParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysDeptParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysDeptParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysSexParseFunction.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/SysSexParseFunction.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/annotations/CrmPermission.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/annotations/CrmPermission.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/aop/CrmPermissionAspect.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/aop/CrmPermissionAspect.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/core/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/permission/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/web/config/CrmWebConfiguration.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/web/config/CrmWebConfiguration.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/api/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/framework/web/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/job/customer/CrmCustomerAutoPutPoolJob.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/job/customer/CrmCustomerAutoPutPoolJob.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/job/package-info.java
0 → 100644
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/package-info.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/package-info.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.business; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 8 | +import jakarta.validation.Valid; | |
| 9 | + | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 商机状态 Service 接口 | |
| 18 | + * | |
| 19 | + * @author ljlleo | |
| 20 | + */ | |
| 21 | +public interface CrmBusinessStatusService { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 创建商机状态 | |
| 25 | + * | |
| 26 | + * @param createReqVO 创建信息 | |
| 27 | + * @return 编号 | |
| 28 | + */ | |
| 29 | + Long createBusinessStatus(@Valid CrmBusinessStatusSaveReqVO createReqVO); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 更新商机状态 | |
| 33 | + * | |
| 34 | + * @param updateReqVO 更新信息 | |
| 35 | + */ | |
| 36 | + void updateBusinessStatus(@Valid CrmBusinessStatusSaveReqVO updateReqVO); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 删除商机状态 | |
| 40 | + * | |
| 41 | + * @param id 编号 | |
| 42 | + */ | |
| 43 | + void deleteBusinessStatusType(Long id); | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 获得商机状态组 | |
| 47 | + * | |
| 48 | + * @param id 编号 | |
| 49 | + * @return 商机状态组 | |
| 50 | + */ | |
| 51 | + CrmBusinessStatusTypeDO getBusinessStatusType(Long id); | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 校验商机状态组 | |
| 55 | + * | |
| 56 | + * @param id 编号 | |
| 57 | + */ | |
| 58 | + void validateBusinessStatusType(Long id); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 获得商机状态组列表 | |
| 62 | + * | |
| 63 | + * @return 商机状态组列表 | |
| 64 | + */ | |
| 65 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得商机状态组分页 | |
| 69 | + * | |
| 70 | + * @param pageReqVO 分页查询 | |
| 71 | + * @return 商机状态组分页 | |
| 72 | + */ | |
| 73 | + PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(PageParam pageReqVO); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 获得商机状态组列表 | |
| 77 | + * | |
| 78 | + * @param ids 编号数组 | |
| 79 | + * @return 商机状态组列表 | |
| 80 | + */ | |
| 81 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 获得商机状态组 Map | |
| 85 | + * | |
| 86 | + * @param ids 编号数组 | |
| 87 | + * @return 商机状态组 Map | |
| 88 | + */ | |
| 89 | + default Map<Long, CrmBusinessStatusTypeDO> getBusinessStatusTypeMap(Collection<Long> ids) { | |
| 90 | + return convertMap(getBusinessStatusTypeList(ids), CrmBusinessStatusTypeDO::getId); | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 获得指定类型的商机状态列表 | |
| 95 | + * | |
| 96 | + * @param typeId 商机状态组编号 | |
| 97 | + * @return 商机状态列表 | |
| 98 | + */ | |
| 99 | + List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Long typeId); | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 获得商机状态列表 | |
| 103 | + * | |
| 104 | + * @param ids 编号数组 | |
| 105 | + * @return 商机状态列表 | |
| 106 | + */ | |
| 107 | + List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids); | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * 获得商机状态 Map | |
| 111 | + * | |
| 112 | + * @param ids 编号数组 | |
| 113 | + * @return 商机状态 Map | |
| 114 | + */ | |
| 115 | + default Map<Long, CrmBusinessStatusDO> getBusinessStatusMap(Collection<Long> ids) { | |
| 116 | + return convertMap(getBusinessStatusList(ids), CrmBusinessStatusDO::getId); | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * 获得商机状态 | |
| 121 | + * | |
| 122 | + * @param id 编号 | |
| 123 | + * @return 商机状态 | |
| 124 | + */ | |
| 125 | + CrmBusinessStatusDO getBusinessStatus(Long id); | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * 校验商机状态 | |
| 129 | + * | |
| 130 | + * @param statusTypeId 商机状态组编号 | |
| 131 | + * @param statusId 商机状态编号 | |
| 132 | + */ | |
| 133 | + CrmBusinessStatusDO validateBusinessStatus(Long statusTypeId, Long statusId); | |
| 134 | + | |
| 135 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.clue; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; | |
| 8 | +import jakarta.validation.Valid; | |
| 9 | + | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 线索 Service 接口 | |
| 14 | + * | |
| 15 | + * @author Wanwan | |
| 16 | + */ | |
| 17 | +public interface CrmClueService { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 创建线索 | |
| 21 | + * | |
| 22 | + * @param createReqVO 创建信息 | |
| 23 | + * @return 编号 | |
| 24 | + */ | |
| 25 | + Long createClue(@Valid CrmClueSaveReqVO createReqVO); | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 更新线索 | |
| 29 | + * | |
| 30 | + * @param updateReqVO 更新信息 | |
| 31 | + */ | |
| 32 | + void updateClue(@Valid CrmClueSaveReqVO updateReqVO); | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 更新线索相关的跟进信息 | |
| 36 | + * | |
| 37 | + * @param id 编号 | |
| 38 | + * @param contactNextTime 下次联系时间 | |
| 39 | + * @param contactLastContent 最后联系内容 | |
| 40 | + */ | |
| 41 | + void updateClueFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 删除线索 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + */ | |
| 48 | + void deleteClue(Long id); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 获得线索 | |
| 52 | + * | |
| 53 | + * @param id 编号 | |
| 54 | + * @return 线索 | |
| 55 | + */ | |
| 56 | + CrmClueDO getClue(Long id); | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 获得线索分页 | |
| 60 | + * | |
| 61 | + * @param pageReqVO 分页查询 | |
| 62 | + * @param userId 用户编号 | |
| 63 | + * @return 线索分页 | |
| 64 | + */ | |
| 65 | + PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 线索转移 | |
| 69 | + * | |
| 70 | + * @param reqVO 请求 | |
| 71 | + * @param userId 用户编号 | |
| 72 | + */ | |
| 73 | + void transferClue(CrmClueTransferReqVO reqVO, Long userId); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 线索转化为客户 | |
| 77 | + * | |
| 78 | + * @param id 线索编号 | |
| 79 | + * @param userId 用户编号 | |
| 80 | + */ | |
| 81 | + void transformClue(Long id, Long userId); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 获得分配给我的、待跟进的线索数量 | |
| 85 | + * | |
| 86 | + * @param userId 用户编号 | |
| 87 | + * @return 数量 | |
| 88 | + */ | |
| 89 | + Long getFollowClueCount(Long userId); | |
| 90 | + | |
| 91 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.contact; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusiness2ReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; | |
| 6 | +import jakarta.validation.Valid; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * CRM 联系人与商机的关联 Service 接口 | |
| 12 | + * | |
| 13 | + * @author 芋道源码 | |
| 14 | + */ | |
| 15 | +public interface CrmContactBusinessService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建联系人与商机的关联【通过联系人,关联商机】 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + */ | |
| 22 | + void createContactBusinessList(@Valid CrmContactBusinessReqVO createReqVO); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 创建联系人与商机的关联【通过商机,关联联系人】 | |
| 26 | + * | |
| 27 | + * @param createReqVO 创建信息 | |
| 28 | + */ | |
| 29 | + void createContactBusinessList2(@Valid CrmContactBusiness2ReqVO createReqVO); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 删除联系人与商机的关联【通过联系人,取关商机】 | |
| 33 | + * | |
| 34 | + * @param deleteReqVO 删除信息 | |
| 35 | + */ | |
| 36 | + void deleteContactBusinessList(@Valid CrmContactBusinessReqVO deleteReqVO); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 删除联系人与商机的关联【通过商机,取关联系人】 | |
| 40 | + * | |
| 41 | + * @param deleteReqVO 删除信息 | |
| 42 | + */ | |
| 43 | + void deleteContactBusinessList2(@Valid CrmContactBusiness2ReqVO deleteReqVO); | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 删除联系人与商机的关联,基于联系人编号 | |
| 47 | + * | |
| 48 | + * @param contactId 联系人编号 | |
| 49 | + */ | |
| 50 | + void deleteContactBusinessByContactId(Long contactId); | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 获得联系人与商机的关联列表,基于联系人编号 | |
| 54 | + * | |
| 55 | + * @param contactId 联系人编号 | |
| 56 | + * @return 联系人商机关联 | |
| 57 | + */ | |
| 58 | + List<CrmContactBusinessDO> getContactBusinessListByContactId(Long contactId); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 获得联系人与商机的关联列表,基于商机编号 | |
| 62 | + * | |
| 63 | + * @param businessId 商机编号 | |
| 64 | + * @return 联系人商机关联 | |
| 65 | + */ | |
| 66 | + List<CrmContactBusinessDO> getContactBusinessListByBusinessId(Long businessId); | |
| 67 | + | |
| 68 | +} | |
| 0 | 69 | \ No newline at end of file | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.contact; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 10 | +import jakarta.validation.Valid; | |
| 11 | + | |
| 12 | +import java.time.LocalDateTime; | |
| 13 | +import java.util.Collection; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 17 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * CRM 联系人 Service 接口 | |
| 21 | + * | |
| 22 | + * @author 芋道源码 | |
| 23 | + */ | |
| 24 | +public interface CrmContactService { | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 创建联系人 | |
| 28 | + * | |
| 29 | + * @param createReqVO 创建信息 | |
| 30 | + * @param userId 用户编号 | |
| 31 | + * @return 编号 | |
| 32 | + */ | |
| 33 | + Long createContact(@Valid CrmContactSaveReqVO createReqVO, Long userId); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 更新联系人 | |
| 37 | + * | |
| 38 | + * @param updateReqVO 更新信息 | |
| 39 | + */ | |
| 40 | + void updateContact(@Valid CrmContactSaveReqVO updateReqVO); | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 删除联系人 | |
| 44 | + * | |
| 45 | + * @param id 编号 | |
| 46 | + */ | |
| 47 | + void deleteContact(Long id); | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 联系人转移 | |
| 51 | + * | |
| 52 | + * @param reqVO 请求 | |
| 53 | + * @param userId 用户编号 | |
| 54 | + */ | |
| 55 | + void transferContact(CrmContactTransferReqVO reqVO, Long userId); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 更新指定客户的联系人的负责人 | |
| 59 | + * 数据权限基于 【客户】 | |
| 60 | + * | |
| 61 | + * @param customerId 客户编号 | |
| 62 | + * @param ownerUserId 用户编号 | |
| 63 | + */ | |
| 64 | + void updateOwnerUserIdByCustomerId(Long customerId, Long ownerUserId); | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 更新联系人相关跟进信息 | |
| 68 | + * | |
| 69 | + * @param id 编号 | |
| 70 | + * @param contactNextTime 下次联系时间 | |
| 71 | + * @param contactLastContent 最后联系内容 | |
| 72 | + */ | |
| 73 | + void updateContactFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 更新联系人的下次联系时间 | |
| 77 | + * | |
| 78 | + * @param ids 编号数组 | |
| 79 | + * @param contactNextTime 下次联系时间 | |
| 80 | + */ | |
| 81 | + void updateContactContactNextTime(Collection<Long> ids, LocalDateTime contactNextTime); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 获得联系人 | |
| 85 | + * | |
| 86 | + * @param id 编号 | |
| 87 | + * @return 联系人 | |
| 88 | + */ | |
| 89 | + CrmContactDO getContact(Long id); | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 校验联系人 | |
| 93 | + * | |
| 94 | + * @param id 编号 | |
| 95 | + */ | |
| 96 | + void validateContact(Long id); | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 获得联系人列表 | |
| 100 | + * | |
| 101 | + * @param ids 编号 | |
| 102 | + * @return 联系人列表 | |
| 103 | + */ | |
| 104 | + List<CrmContactDO> getContactList(Collection<Long> ids); | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 获得联系人 Map | |
| 108 | + * | |
| 109 | + * @param ids 编号 | |
| 110 | + * @return 联系人 Map | |
| 111 | + */ | |
| 112 | + default Map<Long, CrmContactDO> getContactMap(Collection<Long> ids) { | |
| 113 | + return convertMap(getContactList(ids), CrmContactDO::getId); | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * 获取联系人列表(校验权限) | |
| 118 | + * | |
| 119 | + * @param userId 用户编号 | |
| 120 | + * @return 联系人列表 | |
| 121 | + */ | |
| 122 | + List<CrmContactDO> getContactList(Long userId); | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 获得联系人分页 | |
| 126 | + * | |
| 127 | + * 数据权限:基于 {@link CrmContactDO} | |
| 128 | + * | |
| 129 | + * @param pageReqVO 分页查询 | |
| 130 | + * @param userId 用户编号 | |
| 131 | + * @return 联系人分页 | |
| 132 | + */ | |
| 133 | + PageResult<CrmContactDO> getContactPage(CrmContactPageReqVO pageReqVO, Long userId); | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 获得联系人分页 | |
| 137 | + * | |
| 138 | + * 数据权限:基于 {@link CrmCustomerDO} | |
| 139 | + * | |
| 140 | + * @param pageVO 分页查询 | |
| 141 | + * @return 联系人分页 | |
| 142 | + */ | |
| 143 | + PageResult<CrmContactDO> getContactPageByCustomerId(CrmContactPageReqVO pageVO); | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 获得联系人分页 | |
| 147 | + * | |
| 148 | + * 数据权限:基于 {@link CrmBusinessDO} | |
| 149 | + * | |
| 150 | + * @param pageVO 分页查询 | |
| 151 | + * @return 联系人分页 | |
| 152 | + */ | |
| 153 | + PageResult<CrmContactDO> getContactPageByBusinessId(CrmContactPageReqVO pageVO); | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 获取关联客户的联系人数量 | |
| 157 | + * | |
| 158 | + * @param customerId 客户编号 | |
| 159 | + * @return 数量 | |
| 160 | + */ | |
| 161 | + Long getContactCountByCustomerId(Long customerId); | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * 获得联系人列表 | |
| 165 | + * | |
| 166 | + * @param customerId 客户编号 | |
| 167 | + * @param ownerUserId 负责人编号 | |
| 168 | + * @return 联系人列表 | |
| 169 | + */ | |
| 170 | + List<CrmContactDO> getContactListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); | |
| 171 | + | |
| 172 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractConfigService.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractConfigService.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractConfigServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.contract; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.config.CrmContractConfigSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractConfigDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractConfigMapper; | |
| 7 | +import com.mzt.logapi.context.LogRecordContext; | |
| 8 | +import com.mzt.logapi.starter.annotation.LogRecord; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | +import org.springframework.stereotype.Service; | |
| 11 | +import org.springframework.validation.annotation.Validated; | |
| 12 | + | |
| 13 | +import java.util.Objects; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 合同配置 Service 实现类 | |
| 19 | + * | |
| 20 | + * @author 芋道源码 | |
| 21 | + */ | |
| 22 | +@Service | |
| 23 | +@Validated | |
| 24 | +public class CrmContractConfigServiceImpl implements CrmContractConfigService { | |
| 25 | + | |
| 26 | + @Resource | |
| 27 | + private CrmContractConfigMapper contractConfigMapper; | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public CrmContractConfigDO getContractConfig() { | |
| 31 | + return contractConfigMapper.selectOne(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + @LogRecord(type = CRM_CONTRACT_CONFIG_TYPE, subType = CRM_CONTRACT_CONFIG_SUB_TYPE, bizNo = "{{#configId}}", | |
| 36 | + success = CRM_CONTRACT_CONFIG_SUCCESS) | |
| 37 | + public void saveContractConfig(CrmContractConfigSaveReqVO saveReqVO) { | |
| 38 | + // 1. 存在,则进行更新 | |
| 39 | + CrmContractConfigDO dbConfig = getContractConfig(); | |
| 40 | + CrmContractConfigDO config = BeanUtils.toBean(saveReqVO, CrmContractConfigDO.class); | |
| 41 | + if (Objects.nonNull(dbConfig)) { | |
| 42 | + contractConfigMapper.updateById(config.setId(dbConfig.getId())); | |
| 43 | + // 记录操作日志上下文 | |
| 44 | + LogRecordContext.putVariable("isConfigUpdate", Boolean.TRUE); | |
| 45 | + LogRecordContext.putVariable("configId", config.getId()); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 49 | + // 2. 不存在,则进行插入 | |
| 50 | + contractConfigMapper.insert(config); | |
| 51 | + // 记录操作日志上下文 | |
| 52 | + LogRecordContext.putVariable("isConfigUpdate", Boolean.FALSE); | |
| 53 | + LogRecordContext.putVariable("configId", config.getId()); | |
| 54 | + } | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/contract/listener/CrmContractStatusListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.contract.listener; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; | |
| 4 | +import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; | |
| 5 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 6 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractServiceImpl; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 合同审批的结果的监听器实现类 | |
| 12 | + * | |
| 13 | + * @author HUIHUI | |
| 14 | + */ | |
| 15 | +@Component | |
| 16 | +public class CrmContractStatusListener extends BpmProcessInstanceStatusEventListener { | |
| 17 | + | |
| 18 | + @Resource | |
| 19 | + private CrmContractService contractService; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public String getProcessDefinitionKey() { | |
| 23 | + return CrmContractServiceImpl.BPM_PROCESS_DEFINITION_KEY; | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + protected void onEvent(BpmProcessInstanceStatusEvent event) { | |
| 28 | + contractService.updateContractAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | |
| 29 | + } | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | |
| 7 | +import jakarta.validation.Valid; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 客户限制配置 Service 接口 | |
| 13 | + * | |
| 14 | + * @author Wanwan | |
| 15 | + */ | |
| 16 | +public interface CrmCustomerLimitConfigService { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 创建客户限制配置 | |
| 20 | + * | |
| 21 | + * @param createReqVO 创建信息 | |
| 22 | + * @return 编号 | |
| 23 | + */ | |
| 24 | + Long createCustomerLimitConfig(@Valid CrmCustomerLimitConfigSaveReqVO createReqVO); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 更新客户限制配置 | |
| 28 | + * | |
| 29 | + * @param updateReqVO 更新信息 | |
| 30 | + */ | |
| 31 | + void updateCustomerLimitConfig(@Valid CrmCustomerLimitConfigSaveReqVO updateReqVO); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 删除客户限制配置 | |
| 35 | + * | |
| 36 | + * @param id 编号 | |
| 37 | + */ | |
| 38 | + void deleteCustomerLimitConfig(Long id); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 获得客户限制配置 | |
| 42 | + * | |
| 43 | + * @param id 编号 | |
| 44 | + * @return 客户限制配置 | |
| 45 | + */ | |
| 46 | + CrmCustomerLimitConfigDO getCustomerLimitConfig(Long id); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 获得客户限制配置分页 | |
| 50 | + * | |
| 51 | + * @param pageReqVO 分页查询 | |
| 52 | + * @return 客户限制配置分页 | |
| 53 | + */ | |
| 54 | + PageResult<CrmCustomerLimitConfigDO> getCustomerLimitConfigPage(CrmCustomerLimitConfigPageReqVO pageReqVO); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 查询用户对应的配置列表 | |
| 58 | + * | |
| 59 | + * @param type 类型 | |
| 60 | + * @param userId 用户类型 | |
| 61 | + */ | |
| 62 | + List<CrmCustomerLimitConfigDO> getCustomerLimitConfigListByUserId(Integer type, Long userId); | |
| 63 | + | |
| 64 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigService.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigService.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper; | |
| 7 | +import com.mzt.logapi.context.LogRecordContext; | |
| 8 | +import com.mzt.logapi.starter.annotation.LogRecord; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | +import org.springframework.stereotype.Service; | |
| 11 | +import org.springframework.validation.annotation.Validated; | |
| 12 | + | |
| 13 | +import java.util.Objects; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 客户公海配置 Service 实现类 | |
| 19 | + * | |
| 20 | + * @author Wanwan | |
| 21 | + */ | |
| 22 | +@Service | |
| 23 | +@Validated | |
| 24 | +public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigService { | |
| 25 | + | |
| 26 | + @Resource | |
| 27 | + private CrmCustomerPoolConfigMapper customerPoolConfigMapper; | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public CrmCustomerPoolConfigDO getCustomerPoolConfig() { | |
| 31 | + return customerPoolConfigMapper.selectOne(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + @LogRecord(type = CRM_CUSTOMER_POOL_CONFIG_TYPE, subType = CRM_CUSTOMER_POOL_CONFIG_SUB_TYPE, bizNo = "{{#poolConfigId}}", | |
| 36 | + success = CRM_CUSTOMER_POOL_CONFIG_SUCCESS) | |
| 37 | + public void saveCustomerPoolConfig(CrmCustomerPoolConfigSaveReqVO saveReqVO) { | |
| 38 | + // 1. 存在,则进行更新 | |
| 39 | + CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); | |
| 40 | + CrmCustomerPoolConfigDO poolConfig = BeanUtils.toBean(saveReqVO, CrmCustomerPoolConfigDO.class); | |
| 41 | + if (Objects.nonNull(dbConfig)) { | |
| 42 | + customerPoolConfigMapper.updateById(poolConfig.setId(dbConfig.getId())); | |
| 43 | + // 记录操作日志上下文 | |
| 44 | + LogRecordContext.putVariable("isPoolConfigUpdate", Boolean.TRUE); | |
| 45 | + LogRecordContext.putVariable("poolConfigId", poolConfig.getId()); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 49 | + // 2. 不存在,则进行插入 | |
| 50 | + customerPoolConfigMapper.insert(poolConfig); | |
| 51 | + // 记录操作日志上下文 | |
| 52 | + LogRecordContext.putVariable("isPoolConfigUpdate", Boolean.FALSE); | |
| 53 | + LogRecordContext.putVariable("poolConfigId", poolConfig.getId()); | |
| 54 | + } | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
| 1 | -package cn.iocoder.yudao.module.crm.service.contact; | |
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*; | |
| 9 | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 6 | +import cn.iocoder.yudao.module.crm.service.customer.bo.CrmCustomerCreateReqBO; | |
| 10 | 7 | import jakarta.validation.Valid; |
| 11 | 8 | |
| 12 | 9 | import java.time.LocalDateTime; |
| ... | ... | @@ -17,156 +14,185 @@ import java.util.Map; |
| 17 | 14 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 18 | 15 | |
| 19 | 16 | /** |
| 20 | - * CRM 联系人 Service 接口 | |
| 17 | + * 客户 Service 接口 | |
| 21 | 18 | * |
| 22 | - * @author 芋道源码 | |
| 19 | + * @author Wanwan | |
| 23 | 20 | */ |
| 24 | -public interface CrmContactService { | |
| 21 | +public interface CrmCustomerService { | |
| 25 | 22 | |
| 26 | 23 | /** |
| 27 | - * 创建联系人 | |
| 24 | + * 创建客户 | |
| 28 | 25 | * |
| 29 | 26 | * @param createReqVO 创建信息 |
| 30 | 27 | * @param userId 用户编号 |
| 31 | 28 | * @return 编号 |
| 32 | 29 | */ |
| 33 | - Long createContact(@Valid CrmContactSaveReqVO createReqVO, Long userId); | |
| 30 | + Long createCustomer(@Valid CrmCustomerSaveReqVO createReqVO, Long userId); | |
| 34 | 31 | |
| 35 | 32 | /** |
| 36 | - * 更新联系人 | |
| 33 | + * 更新客户 | |
| 37 | 34 | * |
| 38 | 35 | * @param updateReqVO 更新信息 |
| 39 | 36 | */ |
| 40 | - void updateContact(@Valid CrmContactSaveReqVO updateReqVO); | |
| 37 | + void updateCustomer(@Valid CrmCustomerSaveReqVO updateReqVO); | |
| 41 | 38 | |
| 42 | 39 | /** |
| 43 | - * 删除联系人 | |
| 40 | + * 更新客户的跟进状态 | |
| 44 | 41 | * |
| 45 | - * @param id 编号 | |
| 42 | + * @param id 编号 | |
| 43 | + * @param dealStatus 跟进状态 | |
| 46 | 44 | */ |
| 47 | - void deleteContact(Long id); | |
| 45 | + void updateCustomerDealStatus(Long id, Boolean dealStatus); | |
| 48 | 46 | |
| 49 | 47 | /** |
| 50 | - * 联系人转移 | |
| 48 | + * 更新客户相关的跟进信息 | |
| 51 | 49 | * |
| 52 | - * @param reqVO 请求 | |
| 53 | - * @param userId 用户编号 | |
| 50 | + * @param id 编号 | |
| 51 | + * @param contactNextTime 下次联系时间 | |
| 52 | + * @param contactLastContent 最后联系内容 | |
| 54 | 53 | */ |
| 55 | - void transferContact(CrmContactTransferReqVO reqVO, Long userId); | |
| 54 | + void updateCustomerFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 56 | 55 | |
| 57 | 56 | /** |
| 58 | - * 更新指定客户的联系人的负责人 | |
| 59 | - * 数据权限基于 【客户】 | |
| 57 | + * 删除客户 | |
| 60 | 58 | * |
| 61 | - * @param customerId 客户编号 | |
| 62 | - * @param ownerUserId 用户编号 | |
| 59 | + * @param id 编号 | |
| 63 | 60 | */ |
| 64 | - void updateOwnerUserIdByCustomerId(Long customerId, Long ownerUserId); | |
| 61 | + void deleteCustomer(Long id); | |
| 65 | 62 | |
| 66 | 63 | /** |
| 67 | - * 更新联系人相关跟进信息 | |
| 64 | + * 获得客户 | |
| 68 | 65 | * |
| 69 | - * @param id 编号 | |
| 70 | - * @param contactNextTime 下次联系时间 | |
| 71 | - * @param contactLastContent 最后联系内容 | |
| 66 | + * @param id 编号 | |
| 67 | + * @return 客户 | |
| 72 | 68 | */ |
| 73 | - void updateContactFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 69 | + CrmCustomerDO getCustomer(Long id); | |
| 74 | 70 | |
| 75 | 71 | /** |
| 76 | - * 更新联系人的下次联系时间 | |
| 72 | + * 获得客户列表 | |
| 77 | 73 | * |
| 78 | - * @param ids 编号数组 | |
| 79 | - * @param contactNextTime 下次联系时间 | |
| 74 | + * @param ids 客户编号数组 | |
| 75 | + * @return 客户列表 | |
| 76 | + * @author ljlleo | |
| 80 | 77 | */ |
| 81 | - void updateContactContactNextTime(Collection<Long> ids, LocalDateTime contactNextTime); | |
| 78 | + List<CrmCustomerDO> getCustomerList(Collection<Long> ids); | |
| 82 | 79 | |
| 83 | 80 | /** |
| 84 | - * 获得联系人 | |
| 81 | + * 获得客户 Map | |
| 85 | 82 | * |
| 86 | - * @param id 编号 | |
| 87 | - * @return 联系人 | |
| 83 | + * @param ids 客户编号数组 | |
| 84 | + * @return 客户 Map | |
| 88 | 85 | */ |
| 89 | - CrmContactDO getContact(Long id); | |
| 86 | + default Map<Long, CrmCustomerDO> getCustomerMap(Collection<Long> ids) { | |
| 87 | + return convertMap(getCustomerList(ids), CrmCustomerDO::getId); | |
| 88 | + } | |
| 90 | 89 | |
| 91 | 90 | /** |
| 92 | - * 校验联系人 | |
| 91 | + * 获得客户分页 | |
| 93 | 92 | * |
| 94 | - * @param id 编号 | |
| 93 | + * @param pageReqVO 分页查询 | |
| 94 | + * @param userId 用户编号 | |
| 95 | + * @return 客户分页 | |
| 95 | 96 | */ |
| 96 | - void validateContact(Long id); | |
| 97 | + PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO, Long userId); | |
| 97 | 98 | |
| 98 | 99 | /** |
| 99 | - * 获得联系人列表 | |
| 100 | + * 获得放入公海提醒的客户分页 | |
| 100 | 101 | * |
| 101 | - * @param ids 编号 | |
| 102 | - * @return 联系人列表 | |
| 102 | + * @param pageVO 分页查询 | |
| 103 | + * @param userId 用户编号 | |
| 104 | + * @return 客户分页 | |
| 103 | 105 | */ |
| 104 | - List<CrmContactDO> getContactList(Collection<Long> ids); | |
| 106 | + PageResult<CrmCustomerDO> getPutPoolRemindCustomerPage(CrmCustomerPageReqVO pageVO, Long userId); | |
| 105 | 107 | |
| 106 | 108 | /** |
| 107 | - * 获得联系人 Map | |
| 109 | + * 获得待进入公海的客户数量 | |
| 108 | 110 | * |
| 109 | - * @param ids 编号 | |
| 110 | - * @return 联系人 Map | |
| 111 | + * @param userId 用户编号 | |
| 112 | + * @return 提醒数量 | |
| 111 | 113 | */ |
| 112 | - default Map<Long, CrmContactDO> getContactMap(Collection<Long> ids) { | |
| 113 | - return convertMap(getContactList(ids), CrmContactDO::getId); | |
| 114 | - } | |
| 114 | + Long getPutPoolRemindCustomerCount(Long userId); | |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | - * 获取联系人列表(校验权限) | |
| 117 | + * 获得今日需联系客户数量 | |
| 118 | 118 | * |
| 119 | 119 | * @param userId 用户编号 |
| 120 | - * @return 联系人列表 | |
| 120 | + * @return 提醒数量 | |
| 121 | 121 | */ |
| 122 | - List<CrmContactDO> getContactList(Long userId); | |
| 122 | + Long getTodayContactCustomerCount(Long userId); | |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * 获得联系人分页 | |
| 125 | + * 获得分配给我的客户数量 | |
| 126 | 126 | * |
| 127 | - * 数据权限:基于 {@link CrmContactDO} | |
| 127 | + * @param userId 用户编号 | |
| 128 | + * @return 提醒数量 | |
| 129 | + */ | |
| 130 | + Long getFollowCustomerCount(Long userId); | |
| 131 | + | |
| 132 | + /** | |
| 133 | + * 校验客户是否存在 | |
| 128 | 134 | * |
| 129 | - * @param pageReqVO 分页查询 | |
| 130 | - * @param userId 用户编号 | |
| 131 | - * @return 联系人分页 | |
| 135 | + * @param id 编号 | |
| 132 | 136 | */ |
| 133 | - PageResult<CrmContactDO> getContactPage(CrmContactPageReqVO pageReqVO, Long userId); | |
| 137 | + void validateCustomer(Long id); | |
| 134 | 138 | |
| 135 | 139 | /** |
| 136 | - * 获得联系人分页 | |
| 140 | + * 客户转移 | |
| 137 | 141 | * |
| 138 | - * 数据权限:基于 {@link CrmCustomerDO} | |
| 142 | + * @param reqVO 请求 | |
| 143 | + * @param userId 用户编号 | |
| 144 | + */ | |
| 145 | + void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId); | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * 锁定/解锁客户 | |
| 139 | 149 | * |
| 140 | - * @param pageVO 分页查询 | |
| 141 | - * @return 联系人分页 | |
| 150 | + * @param lockReqVO 更新信息 | |
| 151 | + * @param userId 用户编号 | |
| 142 | 152 | */ |
| 143 | - PageResult<CrmContactDO> getContactPageByCustomerId(CrmContactPageReqVO pageVO); | |
| 153 | + void lockCustomer(@Valid CrmCustomerLockReqVO lockReqVO, Long userId); | |
| 144 | 154 | |
| 145 | 155 | /** |
| 146 | - * 获得联系人分页 | |
| 156 | + * 创建客户 | |
| 147 | 157 | * |
| 148 | - * 数据权限:基于 {@link CrmBusinessDO} | |
| 158 | + * @param customerCreateReq 请求信息 | |
| 159 | + * @param userId 用户编号 | |
| 160 | + * @return 客户列表 | |
| 161 | + */ | |
| 162 | + Long createCustomer(CrmCustomerCreateReqBO customerCreateReq, Long userId); | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * 批量导入客户 | |
| 149 | 166 | * |
| 150 | - * @param pageVO 分页查询 | |
| 151 | - * @return 联系人分页 | |
| 167 | + * @param importCustomers 导入客户列表 | |
| 168 | + * @param importReqVO 请求 | |
| 169 | + * @return 导入结果 | |
| 170 | + */ | |
| 171 | + CrmCustomerImportRespVO importCustomerList(List<CrmCustomerImportExcelVO> importCustomers, CrmCustomerImportReqVO importReqVO); | |
| 172 | + | |
| 173 | + // ==================== 公海相关操作 ==================== | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * 客户放入公海 | |
| 177 | + * | |
| 178 | + * @param id 客户编号 | |
| 152 | 179 | */ |
| 153 | - PageResult<CrmContactDO> getContactPageByBusinessId(CrmContactPageReqVO pageVO); | |
| 180 | + void putCustomerPool(Long id); | |
| 154 | 181 | |
| 155 | 182 | /** |
| 156 | - * 获取关联客户的联系人数量 | |
| 183 | + * 领取公海客户 | |
| 157 | 184 | * |
| 158 | - * @param customerId 客户编号 | |
| 159 | - * @return 数量 | |
| 185 | + * @param ids 要领取的客户编号数组 | |
| 186 | + * @param ownerUserId 负责人 | |
| 187 | + * @param isReceive 是/否领取;true - 领取;false - 分配 | |
| 160 | 188 | */ |
| 161 | - Long getContactCountByCustomerId(Long customerId); | |
| 189 | + void receiveCustomer(List<Long> ids, Long ownerUserId, Boolean isReceive); | |
| 162 | 190 | |
| 163 | 191 | /** |
| 164 | - * 获得联系人列表 | |
| 192 | + * 【系统】客户自动掉入公海 | |
| 165 | 193 | * |
| 166 | - * @param customerId 客户编号 | |
| 167 | - * @param ownerUserId 负责人编号 | |
| 168 | - * @return 联系人列表 | |
| 194 | + * @return 掉入公海数量 | |
| 169 | 195 | */ |
| 170 | - List<CrmContactDO> getContactListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId); | |
| 196 | + int autoPutCustomerPool(); | |
| 171 | 197 | |
| 172 | 198 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/bo/CrmCustomerCreateReqBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer.bo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.Mobile; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.Telephone; | |
| 5 | +import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | |
| 6 | +import jakarta.validation.constraints.Email; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.Size; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 客户创建 Create Req BO | |
| 15 | + * | |
| 16 | + * @author HUIHUI | |
| 17 | + */ | |
| 18 | +@Data | |
| 19 | +public class CrmCustomerCreateReqBO { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 客户名称 | |
| 23 | + */ | |
| 24 | + @NotEmpty(message = "客户名称不能为空") | |
| 25 | + private String name; | |
| 26 | + /** | |
| 27 | + * 跟进状态 | |
| 28 | + */ | |
| 29 | + private Boolean followUpStatus; | |
| 30 | + /** | |
| 31 | + * 锁定状态 | |
| 32 | + */ | |
| 33 | + private Boolean lockStatus; | |
| 34 | + /** | |
| 35 | + * 成交状态 | |
| 36 | + */ | |
| 37 | + private Boolean dealStatus; | |
| 38 | + /** | |
| 39 | + * 所属行业 | |
| 40 | + * | |
| 41 | + * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_INDUSTRY} | |
| 42 | + */ | |
| 43 | + private Integer industryId; | |
| 44 | + /** | |
| 45 | + * 客户等级 | |
| 46 | + * | |
| 47 | + * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_LEVEL} | |
| 48 | + */ | |
| 49 | + private Integer level; | |
| 50 | + /** | |
| 51 | + * 客户来源 | |
| 52 | + * | |
| 53 | + * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_SOURCE} | |
| 54 | + */ | |
| 55 | + private Integer source; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 手机 | |
| 59 | + */ | |
| 60 | + @Mobile | |
| 61 | + private String mobile; | |
| 62 | + /** | |
| 63 | + * 电话 | |
| 64 | + */ | |
| 65 | + @Telephone | |
| 66 | + private String telephone; | |
| 67 | + /** | |
| 68 | ||
| 69 | + */ | |
| 70 | + private String qq; | |
| 71 | + /** | |
| 72 | ||
| 73 | + */ | |
| 74 | + private String wechat; | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 邮箱 | |
| 78 | + */ | |
| 79 | + @Email(message = "邮箱格式不正确") | |
| 80 | + private String email; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 客户描述 | |
| 84 | + */ | |
| 85 | + @Size(max = 4096, message = "客户描述长度不能超过 4096 个字符") | |
| 86 | + private String description; | |
| 87 | + /** | |
| 88 | + * 备注 | |
| 89 | + */ | |
| 90 | + private String remark; | |
| 91 | + /** | |
| 92 | + * 负责人的用户编号 | |
| 93 | + * | |
| 94 | + * 关联 AdminUserDO 的 id 字段 | |
| 95 | + */ | |
| 96 | + private Long ownerUserId; | |
| 97 | + /** | |
| 98 | + * 所在地 | |
| 99 | + * | |
| 100 | + * 关联 {@link cn.iocoder.yudao.framework.ip.core.Area#getId()} 字段 | |
| 101 | + */ | |
| 102 | + private Integer areaId; | |
| 103 | + /** | |
| 104 | + * 详细地址 | |
| 105 | + */ | |
| 106 | + private String detailAddress; | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * 最后跟进时间 | |
| 110 | + */ | |
| 111 | + private LocalDateTime contactLastTime; | |
| 112 | + /** | |
| 113 | + * 最后跟进内容 | |
| 114 | + */ | |
| 115 | + private String contactLastContent; | |
| 116 | + /** | |
| 117 | + * 下次联系时间 | |
| 118 | + */ | |
| 119 | + private LocalDateTime contactNextTime; | |
| 120 | + | |
| 121 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.followup; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmFollowUpCreateReqBO; | |
| 8 | +import jakarta.validation.Valid; | |
| 9 | + | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 跟进记录 Service 接口 | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +public interface CrmFollowUpRecordService { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 创建跟进记录 (数据权限基于 bizType、 bizId) | |
| 22 | + * | |
| 23 | + * @param createReqVO 创建信息 | |
| 24 | + * @return 编号 | |
| 25 | + */ | |
| 26 | + Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO); | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 创建更进 | |
| 30 | + * | |
| 31 | + * @param list 请求 | |
| 32 | + */ | |
| 33 | + void createFollowUpRecordBatch(List<CrmFollowUpCreateReqBO> list); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 删除跟进记录 (数据权限基于 bizType、 bizId) | |
| 37 | + * | |
| 38 | + * @param id 编号 | |
| 39 | + * @param userId 用户编号 | |
| 40 | + */ | |
| 41 | + void deleteFollowUpRecord(Long id, Long userId); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 删除跟进 | |
| 45 | + * | |
| 46 | + * @param bizType 模块类型 | |
| 47 | + * @param bizId 模块数据编号 | |
| 48 | + */ | |
| 49 | + void deleteFollowUpRecordByBiz(Integer bizType, Long bizId); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得跟进记录 | |
| 53 | + * | |
| 54 | + * @param id 编号 | |
| 55 | + * @return 跟进记录 | |
| 56 | + */ | |
| 57 | + CrmFollowUpRecordDO getFollowUpRecord(Long id); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得跟进记录分页 (数据权限基于 bizType、 bizId) | |
| 61 | + * | |
| 62 | + * @param pageReqVO 分页查询 | |
| 63 | + * @return 跟进记录分页 | |
| 64 | + */ | |
| 65 | + PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获取跟进记录 | |
| 69 | + * | |
| 70 | + * @param bizType 模块类型 | |
| 71 | + * @param bizIds 模块数据编号 | |
| 72 | + * @return 跟进列表 | |
| 73 | + */ | |
| 74 | + List<CrmFollowUpRecordDO> getFollowUpRecordByBiz(Integer bizType, Collection<Long> bizIds); | |
| 75 | + | |
| 76 | +} | |
| 0 | 77 | \ No newline at end of file | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmFollowUpCreateReqBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.followup.bo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | |
| 6 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 跟进信息 Create Req BO | |
| 16 | + * | |
| 17 | + * @author HUIHUI | |
| 18 | + */ | |
| 19 | +@Data | |
| 20 | +public class CrmFollowUpCreateReqBO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 数据类型 | |
| 24 | + * | |
| 25 | + * 枚举 {@link CrmBizTypeEnum} | |
| 26 | + */ | |
| 27 | + @NotNull(message = "数据类型不能为空") | |
| 28 | + private Integer bizType; | |
| 29 | + /** | |
| 30 | + * 数据编号 | |
| 31 | + * | |
| 32 | + * 关联 {@link CrmBizTypeEnum} 对应模块 DO 的 id 字段 | |
| 33 | + */ | |
| 34 | + @NotNull(message = "数据编号不能为空") | |
| 35 | + private Long bizId; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 跟进类型 | |
| 39 | + * | |
| 40 | + * 关联 {@link DictTypeConstants#CRM_FOLLOW_UP_TYPE} 字典 | |
| 41 | + */ | |
| 42 | + @NotNull(message = "跟进类型不能为空") | |
| 43 | + private Integer type; | |
| 44 | + /** | |
| 45 | + * 跟进内容 | |
| 46 | + */ | |
| 47 | + @NotEmpty(message = "跟进内容不能为空") | |
| 48 | + private String content; | |
| 49 | + /** | |
| 50 | + * 下次联系时间 | |
| 51 | + */ | |
| 52 | + @NotNull(message = "下次联系时间不能为空") | |
| 53 | + private LocalDateTime nextTime; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 图片 | |
| 57 | + */ | |
| 58 | + private List<String> picUrls; | |
| 59 | + /** | |
| 60 | + * 附件 | |
| 61 | + */ | |
| 62 | + private List<String> fileUrls; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 关联的商机编号数组 | |
| 66 | + * | |
| 67 | + * 关联 {@link CrmBusinessDO#getId()} | |
| 68 | + */ | |
| 69 | + private List<Long> businessIds; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 关联的联系人编号数组 | |
| 73 | + * | |
| 74 | + * 关联 {@link CrmContactDO#getId()} | |
| 75 | + */ | |
| 76 | + private List<Long> contactIds; | |
| 77 | + | |
| 78 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.permission; | |
| 2 | + | |
| 3 | + | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 8 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 9 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | |
| 10 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | |
| 11 | +import jakarta.validation.Valid; | |
| 12 | + | |
| 13 | +import java.util.Collection; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * crm 数据权限 Service 接口 | |
| 18 | + * | |
| 19 | + * @author HUIHUI | |
| 20 | + */ | |
| 21 | +public interface CrmPermissionService { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 创建数据权限 | |
| 25 | + * | |
| 26 | + * @param reqVO 创建信息 | |
| 27 | + * @param userId 用户编号 | |
| 28 | + */ | |
| 29 | + void createPermission(CrmPermissionSaveReqVO reqVO, Long userId); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 创建数据权限 | |
| 33 | + * | |
| 34 | + * @param createReqBO 创建信息 | |
| 35 | + * @return 编号 | |
| 36 | + */ | |
| 37 | + Long createPermission(@Valid CrmPermissionCreateReqBO createReqBO); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 创建数据权限 | |
| 41 | + * | |
| 42 | + * @param createReqBOs 创建信息 | |
| 43 | + */ | |
| 44 | + void createPermissionBatch(@Valid List<CrmPermissionCreateReqBO> createReqBOs); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 更新数据权限 | |
| 48 | + * | |
| 49 | + * @param updateReqVO 更新信息 | |
| 50 | + */ | |
| 51 | + void updatePermission(CrmPermissionUpdateReqVO updateReqVO); | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 数据权限转移 | |
| 55 | + * | |
| 56 | + * @param crmPermissionTransferReqBO 数据权限转移请求 | |
| 57 | + */ | |
| 58 | + void transferPermission(@Valid CrmPermissionTransferReqBO crmPermissionTransferReqBO); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 删除数据权限 | |
| 62 | + * | |
| 63 | + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 64 | + * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 65 | + * @param level 数据权限级别,关联 {@link CrmPermissionLevelEnum} | |
| 66 | + */ | |
| 67 | + void deletePermission(Integer bizType, Long bizId, Integer level); | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 删除数据权限 | |
| 71 | + * | |
| 72 | + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 73 | + * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 74 | + */ | |
| 75 | + void deletePermission(Integer bizType, Long bizId); | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 批量删除数据权限 | |
| 79 | + * | |
| 80 | + * @param ids 权限编号 | |
| 81 | + * @param userId 用户编号 | |
| 82 | + */ | |
| 83 | + void deletePermissionBatch(Collection<Long> ids, Long userId); | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 删除指定用户数据权限 | |
| 87 | + * | |
| 88 | + * @param id 权限编号 | |
| 89 | + * @param userId 用户编号 | |
| 90 | + */ | |
| 91 | + void deleteSelfPermission(Long id, Long userId); | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 获取数据权限列表,通过 数据类型 x 某个数据 | |
| 95 | + * | |
| 96 | + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 97 | + * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 98 | + * @return Crm 数据权限列表 | |
| 99 | + */ | |
| 100 | + List<CrmPermissionDO> getPermissionListByBiz(Integer bizType, Long bizId); | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 获取数据权限列表,通过 数据类型 x 某个数据 | |
| 104 | + * | |
| 105 | + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 106 | + * @param bizIds 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 107 | + * @return Crm 数据权限列表 | |
| 108 | + */ | |
| 109 | + List<CrmPermissionDO> getPermissionListByBiz(Integer bizType, Collection<Long> bizIds); | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * 获取用户参与的模块数据列表 | |
| 113 | + * | |
| 114 | + * @param bizType 模块类型 | |
| 115 | + * @param userId 用户编号 | |
| 116 | + * @return 模块数据列表 | |
| 117 | + */ | |
| 118 | + List<CrmPermissionDO> getPermissionListByBizTypeAndUserId(Integer bizType, Long userId); | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * 校验是否有指定数据的操作权限 | |
| 122 | + * | |
| 123 | + * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 124 | + * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 125 | + * @param userId 用户编号 | |
| 126 | + * @param level 权限级别 | |
| 127 | + * @return 是否有权限 | |
| 128 | + */ | |
| 129 | + boolean hasPermission(Integer bizType, Long bizId, Long userId, CrmPermissionLevelEnum level); | |
| 130 | + | |
| 131 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/permission/bo/CrmPermissionCreateReqBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.permission.bo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 5 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * crm 数据权限 Create Req BO | |
| 12 | + * | |
| 13 | + * @author HUIHUI | |
| 14 | + */ | |
| 15 | +@Data | |
| 16 | +public class CrmPermissionCreateReqBO { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 当前登录用户编号 | |
| 20 | + */ | |
| 21 | + @NotNull(message = "用户编号不能为空") | |
| 22 | + private Long userId; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * Crm 类型 | |
| 26 | + */ | |
| 27 | + @NotNull(message = "Crm 类型不能为空") | |
| 28 | + @InEnum(CrmBizTypeEnum.class) | |
| 29 | + private Integer bizType; | |
| 30 | + /** | |
| 31 | + * 数据编号 | |
| 32 | + */ | |
| 33 | + @NotNull(message = "Crm 数据编号不能为空") | |
| 34 | + private Long bizId; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 权限级别 | |
| 38 | + */ | |
| 39 | + @NotNull(message = "权限级别不能为空") | |
| 40 | + @InEnum(CrmPermissionLevelEnum.class) | |
| 41 | + private Integer level; | |
| 42 | + | |
| 43 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/permission/bo/CrmPermissionTransferReqBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.permission.bo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 5 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 6 | +import lombok.AllArgsConstructor; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import jakarta.validation.constraints.NotNull; | |
| 10 | +import lombok.NoArgsConstructor; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 数据权限转移 Request BO | |
| 14 | + * | |
| 15 | + * @author HUIHUI | |
| 16 | + */ | |
| 17 | +@Data | |
| 18 | +@NoArgsConstructor | |
| 19 | +@AllArgsConstructor | |
| 20 | +public class CrmPermissionTransferReqBO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 当前登录用户编号 | |
| 24 | + */ | |
| 25 | + @NotNull(message = "用户编号不能为空") | |
| 26 | + private Long userId; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * CRM 类型 | |
| 30 | + */ | |
| 31 | + @NotNull(message = "Crm 类型不能为空") | |
| 32 | + @InEnum(CrmBizTypeEnum.class) | |
| 33 | + private Integer bizType; | |
| 34 | + /** | |
| 35 | + * 数据编号 | |
| 36 | + */ | |
| 37 | + @NotNull(message = "CRM 数据编号不能为空") | |
| 38 | + private Long bizId; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 新负责人的用户编号 | |
| 42 | + */ | |
| 43 | + @NotNull(message = "新负责人的用户编号不能为空") | |
| 44 | + private Long newOwnerUserId; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 48 | + * | |
| 49 | + * 关联 {@link CrmPermissionLevelEnum} | |
| 50 | + */ | |
| 51 | + private Integer oldOwnerPermissionLevel; | |
| 52 | + | |
| 53 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryCreateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryListReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | |
| 6 | +import jakarta.validation.Valid; | |
| 7 | + | |
| 8 | +import java.util.Collection; | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * CRM 产品分类 Service 接口 | |
| 16 | + * | |
| 17 | + * @author ZanGe丶 | |
| 18 | + */ | |
| 19 | +public interface CrmProductCategoryService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建产品分类 | |
| 23 | + * | |
| 24 | + * @param createReqVO 创建信息 | |
| 25 | + * @return 编号 | |
| 26 | + */ | |
| 27 | + Long createProductCategory(@Valid CrmProductCategoryCreateReqVO createReqVO); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新产品分类 | |
| 31 | + * | |
| 32 | + * @param updateReqVO 更新信息 | |
| 33 | + */ | |
| 34 | + void updateProductCategory(@Valid CrmProductCategoryCreateReqVO updateReqVO); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 删除产品分类 | |
| 38 | + * | |
| 39 | + * @param id 编号 | |
| 40 | + */ | |
| 41 | + void deleteProductCategory(Long id); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 获得产品分类 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + * @return 产品分类 | |
| 48 | + */ | |
| 49 | + CrmProductCategoryDO getProductCategory(Long id); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得产品分类列表 | |
| 53 | + * | |
| 54 | + * @param listReqVO 列表请求 | |
| 55 | + * @return 产品分类列表 | |
| 56 | + */ | |
| 57 | + List<CrmProductCategoryDO> getProductCategoryList(CrmProductCategoryListReqVO listReqVO); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得产品分类列表 | |
| 61 | + * | |
| 62 | + * @param ids 编号数组 | |
| 63 | + * @return 产品分类列表 | |
| 64 | + */ | |
| 65 | + List<CrmProductCategoryDO> getProductCategoryList(Collection<Long> ids); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得产品分类 Map | |
| 69 | + * | |
| 70 | + * @param ids 编号数组 | |
| 71 | + * @return 产品分类 Map | |
| 72 | + */ | |
| 73 | + default Map<Long, CrmProductCategoryDO> getProductCategoryMap(Collection<Long> ids) { | |
| 74 | + return convertMap(getProductCategoryList(ids), CrmProductCategoryDO::getId); | |
| 75 | + } | |
| 76 | + | |
| 77 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryListReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.mysql.product.CrmProductCategoryMapper; | |
| 8 | +import com.mzt.logapi.context.LogRecordContext; | |
| 9 | +import com.mzt.logapi.starter.annotation.LogRecord; | |
| 10 | +import jakarta.annotation.Resource; | |
| 11 | +import org.springframework.context.annotation.Lazy; | |
| 12 | +import org.springframework.stereotype.Service; | |
| 13 | +import org.springframework.validation.annotation.Validated; | |
| 14 | + | |
| 15 | +import java.util.Collection; | |
| 16 | +import java.util.List; | |
| 17 | +import java.util.Objects; | |
| 18 | + | |
| 19 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 20 | +import static cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO.PARENT_ID_NULL; | |
| 21 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | |
| 22 | +import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * CRM 产品分类 Service 实现类 | |
| 26 | + * | |
| 27 | + * @author ZanGe丶 | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +@Validated | |
| 31 | +public class CrmProductCategoryServiceImpl implements CrmProductCategoryService { | |
| 32 | + | |
| 33 | + @Resource(name = "crmProductCategoryMapper") | |
| 34 | + private CrmProductCategoryMapper productCategoryMapper; | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + @Lazy // 延迟加载,解决循环依赖问题 | |
| 38 | + private CrmProductService crmProductService; | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_CREATE_SUB_TYPE, bizNo = "{{#productCategoryId}}", | |
| 42 | + success = CRM_PRODUCT_CATEGORY_CREATE_SUCCESS) | |
| 43 | + public Long createProductCategory(CrmProductCategoryCreateReqVO createReqVO) { | |
| 44 | + // 1.1 校验父分类存在 | |
| 45 | + validateParentProductCategory(createReqVO.getParentId()); | |
| 46 | + // 1.2 分类名称是否存在 | |
| 47 | + validateProductNameExists(null, createReqVO.getParentId(), createReqVO.getName()); | |
| 48 | + | |
| 49 | + // 2. 插入分类 | |
| 50 | + CrmProductCategoryDO category = BeanUtils.toBean(createReqVO, CrmProductCategoryDO.class); | |
| 51 | + productCategoryMapper.insert(category); | |
| 52 | + | |
| 53 | + // 3. 记录操作日志上下文 | |
| 54 | + LogRecordContext.putVariable("productCategoryId", category.getId()); | |
| 55 | + return category.getId(); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | |
| 60 | + success = CRM_PRODUCT_CATEGORY_UPDATE_SUCCESS) | |
| 61 | + public void updateProductCategory(CrmProductCategoryCreateReqVO updateReqVO) { | |
| 62 | + // 1.1 校验存在 | |
| 63 | + validateProductCategoryExists(updateReqVO.getId()); | |
| 64 | + // 1.2 校验父分类存在 | |
| 65 | + validateParentProductCategory(updateReqVO.getParentId()); | |
| 66 | + // 1.3 分类名称是否存在 | |
| 67 | + validateProductNameExists(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); | |
| 68 | + | |
| 69 | + // 2. 更新分类 | |
| 70 | + CrmProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, CrmProductCategoryDO.class); | |
| 71 | + productCategoryMapper.updateById(updateObj); | |
| 72 | + } | |
| 73 | + | |
| 74 | + private void validateProductCategoryExists(Long id) { | |
| 75 | + if (productCategoryMapper.selectById(id) == null) { | |
| 76 | + throw exception(PRODUCT_CATEGORY_NOT_EXISTS); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + | |
| 80 | + private void validateParentProductCategory(Long id) { | |
| 81 | + // 如果是根分类,无需验证 | |
| 82 | + if (Objects.equals(id, PARENT_ID_NULL)) { | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + // 父分类不存在 | |
| 86 | + CrmProductCategoryDO category = productCategoryMapper.selectById(id); | |
| 87 | + if (category == null) { | |
| 88 | + throw exception(PRODUCT_CATEGORY_PARENT_NOT_EXISTS); | |
| 89 | + } | |
| 90 | + // 父分类不能是二级分类 | |
| 91 | + if (!Objects.equals(category.getParentId(), PARENT_ID_NULL)) { | |
| 92 | + throw exception(PRODUCT_CATEGORY_PARENT_NOT_FIRST_LEVEL); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + private void validateProductNameExists(Long id, Long parentId, String name) { | |
| 97 | + CrmProductCategoryDO category = productCategoryMapper.selectByParentIdAndName(parentId, name); | |
| 98 | + if (category == null | |
| 99 | + || category.getId().equals(id)) { | |
| 100 | + return; | |
| 101 | + } | |
| 102 | + throw exception(PRODUCT_CATEGORY_EXISTS); | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_DELETE_SUB_TYPE, bizNo = "{{#id}}", | |
| 107 | + success = CRM_PRODUCT_CATEGORY_DELETE_SUCCESS) | |
| 108 | + public void deleteProductCategory(Long id) { | |
| 109 | + // 1.1 校验存在 | |
| 110 | + validateProductCategoryExists(id); | |
| 111 | + // 1.2 校验是否还有子分类 | |
| 112 | + if (productCategoryMapper.selectCountByParentId(id) > 0) { | |
| 113 | + throw exception(PRODUCT_CATEGORY_EXISTS_CHILDREN); | |
| 114 | + } | |
| 115 | + // 1.3 校验是否被产品使用 | |
| 116 | + if (crmProductService.getProductByCategoryId(id) > 0) { | |
| 117 | + throw exception(PRODUCT_CATEGORY_USED); | |
| 118 | + } | |
| 119 | + // 2. 删除 | |
| 120 | + productCategoryMapper.deleteById(id); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @Override | |
| 124 | + public CrmProductCategoryDO getProductCategory(Long id) { | |
| 125 | + return productCategoryMapper.selectById(id); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @Override | |
| 129 | + public List<CrmProductCategoryDO> getProductCategoryList(CrmProductCategoryListReqVO listReqVO) { | |
| 130 | + return productCategoryMapper.selectList(listReqVO); | |
| 131 | + } | |
| 132 | + | |
| 133 | + @Override | |
| 134 | + public List<CrmProductCategoryDO> getProductCategoryList(Collection<Long> ids) { | |
| 135 | + return productCategoryMapper.selectBatchIds(ids); | |
| 136 | + } | |
| 137 | + | |
| 138 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | |
| 7 | +import jakarta.validation.Valid; | |
| 8 | + | |
| 9 | +import java.util.Collection; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * CRM 产品 Service 接口 | |
| 17 | + * | |
| 18 | + * @author ZanGe丶 | |
| 19 | + */ | |
| 20 | +public interface CrmProductService { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 创建产品 | |
| 24 | + * | |
| 25 | + * @param createReqVO 创建信息 | |
| 26 | + * @return 编号 | |
| 27 | + */ | |
| 28 | + Long createProduct(@Valid CrmProductSaveReqVO createReqVO); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 更新产品 | |
| 32 | + * | |
| 33 | + * @param updateReqVO 更新信息 | |
| 34 | + */ | |
| 35 | + void updateProduct(@Valid CrmProductSaveReqVO updateReqVO); | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 删除产品 | |
| 39 | + * | |
| 40 | + * @param id 编号 | |
| 41 | + */ | |
| 42 | + void deleteProduct(Long id); | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 获得产品 | |
| 46 | + * | |
| 47 | + * @param id 编号 | |
| 48 | + * @return 产品 | |
| 49 | + */ | |
| 50 | + CrmProductDO getProduct(Long id); | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 获得产品列表 | |
| 54 | + * | |
| 55 | + * @param ids 编号 | |
| 56 | + * @return 产品列表 | |
| 57 | + */ | |
| 58 | + List<CrmProductDO> getProductList(Collection<Long> ids); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 获得产品 Map | |
| 62 | + * | |
| 63 | + * @param ids 编号 | |
| 64 | + * @return 产品 Map | |
| 65 | + */ | |
| 66 | + default Map<Long, CrmProductDO> getProductMap(Collection<Long> ids) { | |
| 67 | + return convertMap(getProductList(ids), CrmProductDO::getId); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 获得产品分页 | |
| 72 | + * | |
| 73 | + * @param pageReqVO 分页查询 | |
| 74 | + * @return 产品分页 | |
| 75 | + */ | |
| 76 | + PageResult<CrmProductDO> getProductPage(CrmProductPageReqVO pageReqVO); | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 获得产品数量 | |
| 80 | + * | |
| 81 | + * @param categoryId 分类编号 | |
| 82 | + * @return 产品 | |
| 83 | + */ | |
| 84 | + Long getProductByCategoryId(Long categoryId); | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * 获得指定状态的产品列表 | |
| 88 | + * | |
| 89 | + * @param status 状态 | |
| 90 | + * @return 产品列表 | |
| 91 | + */ | |
| 92 | + List<CrmProductDO> getProductListByStatus(Integer status); | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 校验产品们的有效性 | |
| 96 | + * | |
| 97 | + * @param ids 编号数组 | |
| 98 | + * @return 产品列表 | |
| 99 | + */ | |
| 100 | + List<CrmProductDO> validProductList(Collection<Long> ids); | |
| 101 | + | |
| 102 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | |
| 8 | +import jakarta.validation.Valid; | |
| 9 | + | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * CRM 回款计划 Service 接口 | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +public interface CrmReceivablePlanService { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 创建回款计划 | |
| 22 | + * | |
| 23 | + * @param createReqVO 创建信息 | |
| 24 | + * @return 编号 | |
| 25 | + */ | |
| 26 | + Long createReceivablePlan(@Valid CrmReceivablePlanSaveReqVO createReqVO); | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 更新回款计划 | |
| 30 | + * | |
| 31 | + * @param updateReqVO 更新信息 | |
| 32 | + */ | |
| 33 | + void updateReceivablePlan(@Valid CrmReceivablePlanSaveReqVO updateReqVO); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 更新回款计划关联的回款编号 | |
| 37 | + * | |
| 38 | + * @param id 编号 | |
| 39 | + * @param receivableId 回款编号 | |
| 40 | + */ | |
| 41 | + void updateReceivablePlanReceivableId(Long id, Long receivableId); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 删除回款计划 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + */ | |
| 48 | + void deleteReceivablePlan(Long id); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 获得回款计划 | |
| 52 | + * | |
| 53 | + * @param id 编号 | |
| 54 | + * @return 回款计划 | |
| 55 | + */ | |
| 56 | + CrmReceivablePlanDO getReceivablePlan(Long id); | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 获得回款计划列表 | |
| 60 | + * | |
| 61 | + * @param ids 编号 | |
| 62 | + * @return 回款计划列表 | |
| 63 | + */ | |
| 64 | + List<CrmReceivablePlanDO> getReceivablePlanList(Collection<Long> ids); | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 获得回款计划分页 | |
| 68 | + * | |
| 69 | + * 数据权限:基于 {@link CrmReceivablePlanDO} 读取 | |
| 70 | + * | |
| 71 | + * @param pageReqVO 分页查询 | |
| 72 | + * @param userId 用户编号 | |
| 73 | + * @return 回款计划分页 | |
| 74 | + */ | |
| 75 | + PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId); | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 获得回款计划分页,基于指定客户 | |
| 79 | + * | |
| 80 | + * 数据权限:基于 {@link CrmCustomerDO} 读取 | |
| 81 | + * | |
| 82 | + * @param pageReqVO 分页查询 | |
| 83 | + * @return 回款计划分页 | |
| 84 | + */ | |
| 85 | + PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomerId(CrmReceivablePlanPageReqVO pageReqVO); | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * 获得待回款提醒数量 | |
| 89 | + * | |
| 90 | + * @param userId 用户编号 | |
| 91 | + * @return 提醒数量 | |
| 92 | + */ | |
| 93 | + Long getReceivablePlanRemindCount(Long userId); | |
| 94 | + | |
| 95 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | |
| 8 | +import jakarta.validation.Valid; | |
| 9 | + | |
| 10 | +import java.math.BigDecimal; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * CRM 回款 Service 接口 | |
| 19 | + * | |
| 20 | + * @author 赤焰 | |
| 21 | + */ | |
| 22 | +public interface CrmReceivableService { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 创建回款 | |
| 26 | + * | |
| 27 | + * @param createReqVO 创建信息 | |
| 28 | + * @return 编号 | |
| 29 | + */ | |
| 30 | + Long createReceivable(@Valid CrmReceivableSaveReqVO createReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 更新回款 | |
| 34 | + * | |
| 35 | + * @param updateReqVO 更新信息 | |
| 36 | + */ | |
| 37 | + void updateReceivable(@Valid CrmReceivableSaveReqVO updateReqVO); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 更新回款流程审批结果 | |
| 41 | + * | |
| 42 | + * @param id 回款编号 | |
| 43 | + * @param bpmResult BPM 审批结果 | |
| 44 | + */ | |
| 45 | + void updateReceivableAuditStatus(Long id, Integer bpmResult); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 删除回款 | |
| 49 | + * | |
| 50 | + * @param id 编号 | |
| 51 | + */ | |
| 52 | + void deleteReceivable(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 发起回款审批流程 | |
| 56 | + * | |
| 57 | + * @param id 回款编号 | |
| 58 | + * @param userId 用户编号 | |
| 59 | + */ | |
| 60 | + void submitReceivable(Long id, Long userId); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 获得回款 | |
| 64 | + * | |
| 65 | + * @param id 编号 | |
| 66 | + * @return 回款 | |
| 67 | + */ | |
| 68 | + CrmReceivableDO getReceivable(Long id); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 获得回款列表 | |
| 72 | + * | |
| 73 | + * @param ids 编号 | |
| 74 | + * @return 回款列表 | |
| 75 | + */ | |
| 76 | + List<CrmReceivableDO> getReceivableList(Collection<Long> ids); | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 获得回款 Map | |
| 80 | + * | |
| 81 | + * @param ids 编号 | |
| 82 | + * @return 回款 Map | |
| 83 | + */ | |
| 84 | + default Map<Long, CrmReceivableDO> getReceivableMap(Collection<Long> ids) { | |
| 85 | + return convertMap(getReceivableList(ids), CrmReceivableDO::getId); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 获得回款分页 | |
| 90 | + * | |
| 91 | + * 数据权限:基于 {@link CrmReceivableDO} 读取 | |
| 92 | + * | |
| 93 | + * @param pageReqVO 分页查询 | |
| 94 | + * @param userId 用户编号 | |
| 95 | + * @return 回款分页 | |
| 96 | + */ | |
| 97 | + PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO, Long userId); | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 获得回款分页,基于指定客户 | |
| 101 | + * | |
| 102 | + * 数据权限:基于 {@link CrmCustomerDO} 读取 | |
| 103 | + * | |
| 104 | + * @param pageReqVO 分页查询 | |
| 105 | + * @return 回款分页 | |
| 106 | + */ | |
| 107 | + PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO); | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * 获得待审核回款数量 | |
| 111 | + * | |
| 112 | + * @param userId 用户编号 | |
| 113 | + * @return 待审批数量 | |
| 114 | + */ | |
| 115 | + Long getAuditReceivableCount(Long userId); | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 获得合同已回款金额 Map | |
| 119 | + * | |
| 120 | + * @param contractIds 合同编号 | |
| 121 | + * @return 回款金额 Map | |
| 122 | + */ | |
| 123 | + Map<Long, BigDecimal> getReceivablePriceMapByContractId(Collection<Long> contractIds); | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 根据合同编号查询回款数量 | |
| 127 | + * | |
| 128 | + * @param contractId 合同编号 | |
| 129 | + * @return 回款数量 | |
| 130 | + */ | |
| 131 | + Long getReceivableCountByContractId(Long contractId); | |
| 132 | + | |
| 133 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/listener/CrmReceivableStatusListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.receivable.listener; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; | |
| 4 | +import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; | |
| 5 | +import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService; | |
| 6 | +import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableServiceImpl; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 回款审批的结果的监听器实现类 | |
| 12 | + * | |
| 13 | + * @author HUIHUI | |
| 14 | + */ | |
| 15 | +@Component | |
| 16 | +public class CrmReceivableStatusListener extends BpmProcessInstanceStatusEventListener { | |
| 17 | + | |
| 18 | + @Resource | |
| 19 | + private CrmReceivableService receivableService; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public String getProcessDefinitionKey() { | |
| 23 | + return CrmReceivableServiceImpl.BPM_PROCESS_DEFINITION_KEY; | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public void onEvent(BpmProcessInstanceStatusEvent event) { | |
| 28 | + receivableService.updateReceivableAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | |
| 29 | + } | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsCustomerService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer.*; | |
| 4 | + | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * CRM 客户分析 Service 接口 | |
| 9 | + * | |
| 10 | + * @author dhb52 | |
| 11 | + */ | |
| 12 | +public interface CrmStatisticsCustomerService { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 总量分析(按日期) | |
| 16 | + * | |
| 17 | + * @param reqVO 请求参数 | |
| 18 | + * @return 统计数据 | |
| 19 | + */ | |
| 20 | + List<CrmStatisticsCustomerSummaryByDateRespVO> getCustomerSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 总量分析(按用户) | |
| 24 | + * | |
| 25 | + * @param reqVO 请求参数 | |
| 26 | + * @return 统计数据 | |
| 27 | + */ | |
| 28 | + List<CrmStatisticsCustomerSummaryByUserRespVO> getCustomerSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 跟进次数分析(按日期) | |
| 32 | + * | |
| 33 | + * @param reqVO 请求参数 | |
| 34 | + * @return 统计数据 | |
| 35 | + */ | |
| 36 | + List<CrmStatisticsFollowUpSummaryByDateRespVO> getFollowUpSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 跟进次数分析(按用户) | |
| 40 | + * | |
| 41 | + * @param reqVO 请求参数 | |
| 42 | + * @return 统计数据 | |
| 43 | + */ | |
| 44 | + List<CrmStatisticsFollowUpSummaryByUserRespVO> getFollowUpSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 客户跟进次数分析(按类型) | |
| 48 | + * | |
| 49 | + * @param reqVO 请求参数 | |
| 50 | + * @return 统计数据 | |
| 51 | + */ | |
| 52 | + List<CrmStatisticsFollowUpSummaryByTypeRespVO> getFollowUpSummaryByType(CrmStatisticsCustomerReqVO reqVO); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获取客户的首次合同、回款信息列表,用于【客户转化率】页面 | |
| 56 | + * | |
| 57 | + * @param reqVO 请求参数 | |
| 58 | + * @return 统计数据 | |
| 59 | + */ | |
| 60 | + List<CrmStatisticsCustomerContractSummaryRespVO> getContractSummary(CrmStatisticsCustomerReqVO reqVO); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 公海客户分析(按日期) | |
| 64 | + * | |
| 65 | + * @param reqVO 请求参数 | |
| 66 | + * @return 统计数据 | |
| 67 | + */ | |
| 68 | + List<CrmStatisticsPoolSummaryByDateRespVO> getPoolSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 公海客户分析(按用户) | |
| 72 | + * | |
| 73 | + * @param reqVO 请求参数 | |
| 74 | + * @return 统计数据 | |
| 75 | + */ | |
| 76 | + List<CrmStatisticsPoolSummaryByUserRespVO> getPoolSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 客户成交周期(按日期) | |
| 80 | + * | |
| 81 | + * 成交周期的定义:客户 customer 在创建出来,到合同 contract 第一次成交的时间差 | |
| 82 | + * | |
| 83 | + * @param reqVO 请求参数 | |
| 84 | + * @return 统计数据 | |
| 85 | + */ | |
| 86 | + List<CrmStatisticsCustomerDealCycleByDateRespVO> getCustomerDealCycleByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 客户成交周期(按用户) | |
| 90 | + * | |
| 91 | + * @param reqVO 请求参数 | |
| 92 | + * @return 统计数据 | |
| 93 | + */ | |
| 94 | + List<CrmStatisticsCustomerDealCycleByUserRespVO> getCustomerDealCycleByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 客户成交周期(按区域) | |
| 98 | + * | |
| 99 | + * @param reqVO 请求参数 | |
| 100 | + * @return 统计数据 | |
| 101 | + */ | |
| 102 | + List<CrmStatisticsCustomerDealCycleByAreaRespVO> getCustomerDealCycleByArea(CrmStatisticsCustomerReqVO reqVO); | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 客户成交周期(按产品) | |
| 106 | + * | |
| 107 | + * @param reqVO 请求参数 | |
| 108 | + * @return 统计数据 | |
| 109 | + */ | |
| 110 | + List<CrmStatisticsCustomerDealCycleByProductRespVO> getCustomerDealCycleByProduct(CrmStatisticsCustomerReqVO reqVO); | |
| 111 | + | |
| 112 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsCustomerServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsCustomerServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsFunnelService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.*; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * CRM 销售漏斗分析 Service | |
| 11 | + * | |
| 12 | + * @author HUIHUI | |
| 13 | + */ | |
| 14 | +public interface CrmStatisticsFunnelService { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 获得销售漏斗数据 | |
| 18 | + * | |
| 19 | + * @param reqVO 请求 | |
| 20 | + * @return 销售漏斗数据 | |
| 21 | + */ | |
| 22 | + CrmStatisticFunnelSummaryRespVO getFunnelSummary(CrmStatisticsFunnelReqVO reqVO); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 获得商机结束状态统计 | |
| 26 | + * | |
| 27 | + * @param reqVO 请求 | |
| 28 | + * @return 商机结束状态统计 | |
| 29 | + */ | |
| 30 | + List<CrmStatisticsBusinessSummaryByEndStatusRespVO> getBusinessSummaryByEndStatus(CrmStatisticsFunnelReqVO reqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 获取新增商机分析(按日期) | |
| 34 | + * | |
| 35 | + * @param reqVO 请求 | |
| 36 | + * @return 新增商机分析 | |
| 37 | + */ | |
| 38 | + List<CrmStatisticsBusinessSummaryByDateRespVO> getBusinessSummaryByDate(CrmStatisticsFunnelReqVO reqVO); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 获得商机转化率分析(按日期) | |
| 42 | + * | |
| 43 | + * @param reqVO 请求 | |
| 44 | + * @return 商机转化率分析 | |
| 45 | + */ | |
| 46 | + List<CrmStatisticsBusinessInversionRateSummaryByDateRespVO> getBusinessInversionRateSummaryByDate(CrmStatisticsFunnelReqVO reqVO); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 获得商机分页(按日期) | |
| 50 | + * | |
| 51 | + * @param pageVO 请求 | |
| 52 | + * @return 商机分页 | |
| 53 | + */ | |
| 54 | + PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO); | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsFunnelServiceImpl.java renamed to yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsFunnelServiceImpl.java
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * CRM 员工绩效统计 Service 接口 | |
| 12 | + * | |
| 13 | + * @author scholar | |
| 14 | + */ | |
| 15 | +public interface CrmStatisticsPerformanceService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 员工签约合同数量分析 | |
| 19 | + * | |
| 20 | + * @param performanceReqVO 排行参数 | |
| 21 | + * @return 员工签约合同数量排行分析 | |
| 22 | + */ | |
| 23 | + List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 员工签约合同金额分析 | |
| 27 | + * | |
| 28 | + * @param performanceReqVO 排行参数 | |
| 29 | + * @return 员工签约合同金额分析 | |
| 30 | + */ | |
| 31 | + List<CrmStatisticsPerformanceRespVO> getContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 员工获得回款金额分析 | |
| 35 | + * | |
| 36 | + * @param performanceReqVO 排行参数 | |
| 37 | + * @return 员工获得回款金额分析 | |
| 38 | + */ | |
| 39 | + List<CrmStatisticsPerformanceRespVO> getReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 40 | + | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.collection.ListUtil; | |
| 5 | +import cn.hutool.core.util.ObjUtil; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPerformanceMapper; | |
| 9 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 10 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 11 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 13 | +import jakarta.annotation.Resource; | |
| 14 | +import org.springframework.stereotype.Service; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | + | |
| 17 | +import java.math.BigDecimal; | |
| 18 | +import java.util.ArrayList; | |
| 19 | +import java.util.Collections; | |
| 20 | +import java.util.List; | |
| 21 | +import java.util.Map; | |
| 22 | +import java.util.function.Function; | |
| 23 | + | |
| 24 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 25 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * CRM 员工业绩分析 Service 实现类 | |
| 29 | + * | |
| 30 | + * @author scholar | |
| 31 | + */ | |
| 32 | +@Service | |
| 33 | +@Validated | |
| 34 | +public class CrmStatisticsPerformanceServiceImpl implements CrmStatisticsPerformanceService { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private CrmStatisticsPerformanceMapper performanceMapper; | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private AdminUserApi adminUserApi; | |
| 41 | + @Resource | |
| 42 | + private DeptApi deptApi; | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 46 | + return getPerformance(performanceReqVO, performanceMapper::selectContractCountPerformance); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public List<CrmStatisticsPerformanceRespVO> getContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 51 | + return getPerformance(performanceReqVO, performanceMapper::selectContractPricePerformance); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public List<CrmStatisticsPerformanceRespVO> getReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 56 | + return getPerformance(performanceReqVO, performanceMapper::selectReceivablePricePerformance); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得员工业绩数据 | |
| 61 | + * | |
| 62 | + * 1. 获得今年 + 去年的数据 | |
| 63 | + * 2. 遍历今年的月份,逐个拼接去年的月份数据 | |
| 64 | + * | |
| 65 | + * @param performanceReqVO 参数 | |
| 66 | + * @param performanceFunction 员工业绩统计方法 | |
| 67 | + * @return 员工业绩数据 | |
| 68 | + */ | |
| 69 | + private List<CrmStatisticsPerformanceRespVO> getPerformance(CrmStatisticsPerformanceReqVO performanceReqVO, | |
| 70 | + Function<CrmStatisticsPerformanceReqVO, List<CrmStatisticsPerformanceRespVO>> performanceFunction) { | |
| 71 | + | |
| 72 | + // 1. 获得用户编号数组 | |
| 73 | + List<Long> userIds = getUserIds(performanceReqVO); | |
| 74 | + if (CollUtil.isEmpty(userIds)) { | |
| 75 | + return Collections.emptyList(); | |
| 76 | + } | |
| 77 | + performanceReqVO.setUserIds(userIds); | |
| 78 | + | |
| 79 | + // 2. 获得业绩数据 | |
| 80 | + int year = performanceReqVO.getTimes()[0].getYear(); // 获取查询的年份 | |
| 81 | + performanceReqVO.getTimes()[0] = performanceReqVO.getTimes()[0].minusYears(1); | |
| 82 | + List<CrmStatisticsPerformanceRespVO> performanceList = performanceFunction.apply(performanceReqVO); | |
| 83 | + Map<String, BigDecimal> performanceMap = convertMap(performanceList, CrmStatisticsPerformanceRespVO::getTime, | |
| 84 | + CrmStatisticsPerformanceRespVO::getCurrentMonthCount); | |
| 85 | + | |
| 86 | + // 3. 组装数据返回 | |
| 87 | + List<CrmStatisticsPerformanceRespVO> result = new ArrayList<>(); | |
| 88 | + for (int month = 1; month <= 12; month++) { | |
| 89 | + String currentMonth = String.format("%d%02d", year, month); | |
| 90 | + String lastMonth = month == 1 ? String.format("%d%02d", year - 1, 12) : String.format("%d%02d", year, month - 1); | |
| 91 | + String lastYear = String.format("%d%02d", year - 1, month); | |
| 92 | + result.add(new CrmStatisticsPerformanceRespVO().setTime(currentMonth) | |
| 93 | + .setCurrentMonthCount(performanceMap.getOrDefault(currentMonth, BigDecimal.ZERO)) | |
| 94 | + .setLastMonthCount(performanceMap.getOrDefault(lastMonth, BigDecimal.ZERO)) | |
| 95 | + .setLastYearCount(performanceMap.getOrDefault(lastYear, BigDecimal.ZERO))); | |
| 96 | + } | |
| 97 | + return result; | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 获取用户编号数组。如果用户编号为空, 则获得部门下的用户编号数组,包括子部门的所有用户编号 | |
| 102 | + * | |
| 103 | + * @param reqVO 请求参数 | |
| 104 | + * @return 用户编号数组 | |
| 105 | + */ | |
| 106 | + private List<Long> getUserIds(CrmStatisticsPerformanceReqVO reqVO) { | |
| 107 | + // 情况一:选中某个用户 | |
| 108 | + if (ObjUtil.isNotNull(reqVO.getUserId())) { | |
| 109 | + return ListUtil.of(reqVO.getUserId()); | |
| 110 | + } | |
| 111 | + // 情况二:选中某个部门 | |
| 112 | + // 2.1 获得部门列表 | |
| 113 | + final Long deptId = reqVO.getDeptId(); | |
| 114 | + List<Long> deptIds = convertList(deptApi.getChildDeptList(deptId), DeptRespDTO::getId); | |
| 115 | + deptIds.add(deptId); | |
| 116 | + // 2.2 获得用户编号 | |
| 117 | + return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 118 | + } | |
| 119 | + | |
| 120 | +} | |
| 0 | 121 | \ No newline at end of file | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPortraitService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*; | |
| 4 | + | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * CRM 客户画像 Service 接口 | |
| 9 | + * | |
| 10 | + * @author HUIHUI | |
| 11 | + */ | |
| 12 | +public interface CrmStatisticsPortraitService { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 获取客户地区统计数据 | |
| 16 | + * | |
| 17 | + * @param reqVO 请求参数 | |
| 18 | + * @return 统计数据 | |
| 19 | + */ | |
| 20 | + List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 获取客户行业统计数据 | |
| 24 | + * | |
| 25 | + * @param reqVO 请求参数 | |
| 26 | + * @return 统计数据 | |
| 27 | + */ | |
| 28 | + List<CrmStatisticCustomerIndustryRespVO> getCustomerSummaryByIndustry(CrmStatisticsPortraitReqVO reqVO); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 获取客户级别统计数据 | |
| 32 | + * | |
| 33 | + * @param reqVO 请求参数 | |
| 34 | + * @return 统计数据 | |
| 35 | + */ | |
| 36 | + List<CrmStatisticCustomerLevelRespVO> getCustomerSummaryByLevel(CrmStatisticsPortraitReqVO reqVO); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 获取客户来源统计数据 | |
| 40 | + * | |
| 41 | + * @param reqVO 请求参数 | |
| 42 | + * @return 统计数据 | |
| 43 | + */ | |
| 44 | + List<CrmStatisticCustomerSourceRespVO> getCustomerSummaryBySource(CrmStatisticsPortraitReqVO reqVO); | |
| 45 | + | |
| 46 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPortraitServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.collection.ListUtil; | |
| 5 | +import cn.hutool.core.util.ObjUtil; | |
| 6 | +import cn.iocoder.yudao.framework.ip.core.Area; | |
| 7 | +import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; | |
| 8 | +import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPortraitMapper; | |
| 11 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 12 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 14 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 15 | +import jakarta.annotation.Resource; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | + | |
| 18 | +import java.util.Collections; | |
| 19 | +import java.util.List; | |
| 20 | +import java.util.Map; | |
| 21 | + | |
| 22 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 23 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * CRM 客户画像 Service 实现类 | |
| 27 | + * | |
| 28 | + * @author HUIHUI | |
| 29 | + */ | |
| 30 | +@Service | |
| 31 | +public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitService { | |
| 32 | + | |
| 33 | + @Resource | |
| 34 | + private CrmStatisticsPortraitMapper portraitMapper; | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private AdminUserApi adminUserApi; | |
| 38 | + @Resource | |
| 39 | + private DeptApi deptApi; | |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO) { | |
| 43 | + // 1. 获得用户编号数组 | |
| 44 | + List<Long> userIds = getUserIds(reqVO); | |
| 45 | + if (CollUtil.isEmpty(userIds)) { | |
| 46 | + return Collections.emptyList(); | |
| 47 | + } | |
| 48 | + reqVO.setUserIds(userIds); | |
| 49 | + | |
| 50 | + // 2. 获取客户地区统计数据 | |
| 51 | + List<CrmStatisticCustomerAreaRespVO> list = portraitMapper.selectSummaryListGroupByAreaId(reqVO); | |
| 52 | + if (CollUtil.isEmpty(list)) { | |
| 53 | + return Collections.emptyList(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + // 3. 拼接数据 | |
| 57 | + List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area); | |
| 58 | + Map<Integer, Area> areaMap = convertMap(areaList, Area::getId); | |
| 59 | + return convertList(list, item -> { | |
| 60 | + Integer parentId = AreaUtils.getParentIdByType(item.getAreaId(), AreaTypeEnum.PROVINCE); | |
| 61 | + if (parentId != null) { | |
| 62 | + Area area = areaMap.get(parentId); | |
| 63 | + if (area != null) { | |
| 64 | + item.setAreaId(parentId).setAreaName(area.getName()); | |
| 65 | + return item; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + // 找不到,归到未知 | |
| 69 | + return item.setAreaId(null).setAreaName("未知"); | |
| 70 | + }); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public List<CrmStatisticCustomerIndustryRespVO> getCustomerSummaryByIndustry(CrmStatisticsPortraitReqVO reqVO) { | |
| 75 | + // 1. 获得用户编号数组 | |
| 76 | + List<Long> userIds = getUserIds(reqVO); | |
| 77 | + if (CollUtil.isEmpty(userIds)) { | |
| 78 | + return Collections.emptyList(); | |
| 79 | + } | |
| 80 | + reqVO.setUserIds(userIds); | |
| 81 | + | |
| 82 | + // 2. 获取客户行业统计数据 | |
| 83 | + return portraitMapper.selectCustomerIndustryListGroupByIndustryId(reqVO); | |
| 84 | + } | |
| 85 | + | |
| 86 | + @Override | |
| 87 | + public List<CrmStatisticCustomerSourceRespVO> getCustomerSummaryBySource(CrmStatisticsPortraitReqVO reqVO) { | |
| 88 | + // 1. 获得用户编号数组 | |
| 89 | + List<Long> userIds = getUserIds(reqVO); | |
| 90 | + if (CollUtil.isEmpty(userIds)) { | |
| 91 | + return Collections.emptyList(); | |
| 92 | + } | |
| 93 | + reqVO.setUserIds(userIds); | |
| 94 | + | |
| 95 | + // 2. 获取客户行业统计数据 | |
| 96 | + return portraitMapper.selectCustomerSourceListGroupBySource(reqVO); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public List<CrmStatisticCustomerLevelRespVO> getCustomerSummaryByLevel(CrmStatisticsPortraitReqVO reqVO) { | |
| 101 | + // 1. 获得用户编号数组 | |
| 102 | + List<Long> userIds = getUserIds(reqVO); | |
| 103 | + if (CollUtil.isEmpty(userIds)) { | |
| 104 | + return Collections.emptyList(); | |
| 105 | + } | |
| 106 | + reqVO.setUserIds(userIds); | |
| 107 | + | |
| 108 | + // 2. 获取客户级别统计数据 | |
| 109 | + return portraitMapper.selectCustomerLevelListGroupByLevel(reqVO); | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 获取用户编号数组。如果用户编号为空, 则获得部门下的用户编号数组,包括子部门的所有用户编号 | |
| 114 | + * | |
| 115 | + * @param reqVO 请求参数 | |
| 116 | + * @return 用户编号数组 | |
| 117 | + */ | |
| 118 | + private List<Long> getUserIds(CrmStatisticsPortraitReqVO reqVO) { | |
| 119 | + // 情况一:选中某个用户 | |
| 120 | + if (ObjUtil.isNotNull(reqVO.getUserId())) { | |
| 121 | + return ListUtil.of(reqVO.getUserId()); | |
| 122 | + } | |
| 123 | + // 情况二:选中某个部门 | |
| 124 | + // 2.1 获得部门列表 | |
| 125 | + List<Long> deptIds = convertList(deptApi.getChildDeptList(reqVO.getDeptId()), DeptRespDTO::getId); | |
| 126 | + deptIds.add(reqVO.getDeptId()); | |
| 127 | + // 2.2 获得用户编号 | |
| 128 | + return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 129 | + } | |
| 130 | + | |
| 131 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsRankService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | + | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankReqVO; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * CRM 排行榜统计 Service 接口 | |
| 11 | + * | |
| 12 | + * @author anhaohao | |
| 13 | + */ | |
| 14 | +public interface CrmStatisticsRankService { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 获得合同金额排行榜 | |
| 18 | + * | |
| 19 | + * @param rankReqVO 排行参数 | |
| 20 | + * @return 合同金额排行榜 | |
| 21 | + */ | |
| 22 | + List<CrmStatisticsRankRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 获得回款金额排行榜 | |
| 26 | + * | |
| 27 | + * @param rankReqVO 排行参数 | |
| 28 | + * @return 回款金额排行榜 | |
| 29 | + */ | |
| 30 | + List<CrmStatisticsRankRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 获得签约合同数量排行榜 | |
| 34 | + * | |
| 35 | + * @param rankReqVO 排行参数 | |
| 36 | + * @return 签约合同数量排行榜 | |
| 37 | + */ | |
| 38 | + List<CrmStatisticsRankRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 获得产品销量排行榜 | |
| 42 | + * | |
| 43 | + * @param rankReqVO 排行参数 | |
| 44 | + * @return 产品销量排行榜 | |
| 45 | + */ | |
| 46 | + List<CrmStatisticsRankRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 获得新增客户数排行榜 | |
| 50 | + * | |
| 51 | + * @param rankReqVO 排行参数 | |
| 52 | + * @return 新增客户数排行榜 | |
| 53 | + */ | |
| 54 | + List<CrmStatisticsRankRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 获得联系人数量排行榜 | |
| 58 | + * | |
| 59 | + * @param rankReqVO 排行参数 | |
| 60 | + * @return 联系人数量排行榜 | |
| 61 | + */ | |
| 62 | + List<CrmStatisticsRankRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 获得跟进次数排行榜 | |
| 66 | + * | |
| 67 | + * @param rankReqVO 排行参数 | |
| 68 | + * @return 跟进次数排行榜 | |
| 69 | + */ | |
| 70 | + List<CrmStatisticsRankRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 获得跟进客户数排行榜 | |
| 74 | + * | |
| 75 | + * @param rankReqVO 排行参数 | |
| 76 | + * @return 跟进客户数排行榜 | |
| 77 | + */ | |
| 78 | + List<CrmStatisticsRankRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 79 | + | |
| 80 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsRankServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankMapper; | |
| 8 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 9 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 10 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 11 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 12 | +import jakarta.annotation.Resource; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.validation.annotation.Validated; | |
| 15 | + | |
| 16 | +import java.util.Collections; | |
| 17 | +import java.util.Comparator; | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.Map; | |
| 20 | +import java.util.function.Function; | |
| 21 | + | |
| 22 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 23 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * CRM 排行榜统计 Service 实现类 | |
| 27 | + * | |
| 28 | + * @author anhaohao | |
| 29 | + */ | |
| 30 | +@Service | |
| 31 | +@Validated | |
| 32 | +public class CrmStatisticsRankServiceImpl implements CrmStatisticsRankService { | |
| 33 | + | |
| 34 | + @Resource | |
| 35 | + private CrmStatisticsRankMapper rankMapper; | |
| 36 | + | |
| 37 | + @Resource | |
| 38 | + private AdminUserApi adminUserApi; | |
| 39 | + @Resource | |
| 40 | + private DeptApi deptApi; | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public List<CrmStatisticsRankRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 44 | + return getRank(rankReqVO, rankMapper::selectContractPriceRank); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public List<CrmStatisticsRankRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 49 | + return getRank(rankReqVO, rankMapper::selectReceivablePriceRank); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public List<CrmStatisticsRankRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 54 | + return getRank(rankReqVO, rankMapper::selectContractCountRank); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public List<CrmStatisticsRankRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 59 | + return getRank(rankReqVO, rankMapper::selectProductSalesRank); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public List<CrmStatisticsRankRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 64 | + return getRank(rankReqVO, rankMapper::selectCustomerCountRank); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public List<CrmStatisticsRankRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 69 | + return getRank(rankReqVO, rankMapper::selectContactsCountRank); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public List<CrmStatisticsRankRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 74 | + return getRank(rankReqVO, rankMapper::selectFollowCountRank); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Override | |
| 78 | + public List<CrmStatisticsRankRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 79 | + return getRank(rankReqVO, rankMapper::selectFollowCustomerCountRank); | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 获得排行版数据 | |
| 84 | + * | |
| 85 | + * @param rankReqVO 参数 | |
| 86 | + * @param rankFunction 排行榜方法 | |
| 87 | + * @return 排行版数据 | |
| 88 | + */ | |
| 89 | + private List<CrmStatisticsRankRespVO> getRank(CrmStatisticsRankReqVO rankReqVO, Function<CrmStatisticsRankReqVO, List<CrmStatisticsRankRespVO>> rankFunction) { | |
| 90 | + // 1. 获得用户编号数组 | |
| 91 | + rankReqVO.setUserIds(getUserIds(rankReqVO.getDeptId())); | |
| 92 | + if (CollUtil.isEmpty(rankReqVO.getUserIds())) { | |
| 93 | + return Collections.emptyList(); | |
| 94 | + } | |
| 95 | + // 2. 获得排行数据 | |
| 96 | + List<CrmStatisticsRankRespVO> ranks = rankFunction.apply(rankReqVO); | |
| 97 | + if (CollUtil.isEmpty(ranks)) { | |
| 98 | + return Collections.emptyList(); | |
| 99 | + } | |
| 100 | + ranks.sort(Comparator.comparing(CrmStatisticsRankRespVO::getCount).reversed()); | |
| 101 | + // 3. 拼接用户信息 | |
| 102 | + appendUserInfo(ranks); | |
| 103 | + return ranks; | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 拼接用户信息(昵称、部门) | |
| 108 | + * | |
| 109 | + * @param ranks 排行榜数据 | |
| 110 | + */ | |
| 111 | + private void appendUserInfo(List<CrmStatisticsRankRespVO> ranks) { | |
| 112 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(ranks, CrmStatisticsRankRespVO::getOwnerUserId)); | |
| 113 | + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); | |
| 114 | + ranks.forEach(rank -> MapUtils.findAndThen(userMap, rank.getOwnerUserId(), user -> { | |
| 115 | + rank.setNickname(user.getNickname()); | |
| 116 | + MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> rank.setDeptName(dept.getName())); | |
| 117 | + })); | |
| 118 | + } | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * 获得部门下的用户编号数组,包括子部门的 | |
| 122 | + * | |
| 123 | + * @param deptId 部门编号 | |
| 124 | + * @return 用户编号数组 | |
| 125 | + */ | |
| 126 | + public List<Long> getUserIds(Long deptId) { | |
| 127 | + // 1. 获得部门列表 | |
| 128 | + List<Long> deptIds = convertList(deptApi.getChildDeptList(deptId), DeptRespDTO::getId); | |
| 129 | + deptIds.add(deptId); | |
| 130 | + // 2. 获得用户编号 | |
| 131 | + return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 132 | + } | |
| 133 | + | |
| 134 | +} | |
| 0 | 135 | \ No newline at end of file | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/util/CrmAuditStatusUtils.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.util; | |
| 2 | + | |
| 3 | +import cn.hutool.core.lang.Assert; | |
| 4 | +import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; | |
| 5 | +import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * CRM 流程工具类 | |
| 9 | + * | |
| 10 | + * @author HUIHUI | |
| 11 | + */ | |
| 12 | +public class CrmAuditStatusUtils { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * BPM 审批结果转换 | |
| 16 | + * | |
| 17 | + * @param bpmResult BPM 审批结果 | |
| 18 | + */ | |
| 19 | + public static Integer convertBpmResultToAuditStatus(Integer bpmResult) { | |
| 20 | + Integer auditStatus = BpmTaskStatusEnum.APPROVE.getStatus().equals(bpmResult) ? CrmAuditStatusEnum.APPROVE.getStatus() | |
| 21 | + : BpmTaskStatusEnum.REJECT.getStatus().equals(bpmResult) ? CrmAuditStatusEnum.REJECT.getStatus() | |
| 22 | + : BpmTaskStatusEnum.CANCEL.getStatus().equals(bpmResult) ? BpmTaskStatusEnum.CANCEL.getStatus() : null; | |
| 23 | + Assert.notNull(auditStatus, "BPM 审批结果({}) 转换失败", bpmResult); | |
| 24 | + return auditStatus; | |
| 25 | + } | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/util/CrmPermissionUtils.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.util; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.extra.spring.SpringUtil; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 6 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 7 | +import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | |
| 8 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 9 | +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | |
| 10 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 11 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 12 | +import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; | |
| 13 | +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | |
| 14 | +import com.github.yulichang.autoconfigure.MybatisPlusJoinProperties; | |
| 15 | +import com.github.yulichang.wrapper.MPJLambdaWrapper; | |
| 16 | + | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 20 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * 数据权限工具类 | |
| 24 | + * | |
| 25 | + * @author HUIHUI | |
| 26 | + */ | |
| 27 | +public class CrmPermissionUtils { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 校验用户是否是 CRM 管理员 | |
| 31 | + * | |
| 32 | + * @return 是/否 | |
| 33 | + */ | |
| 34 | + public static boolean isCrmAdmin() { | |
| 35 | + PermissionApi permissionApi = SpringUtil.getBean(PermissionApi.class); | |
| 36 | + return permissionApi.hasAnyRoles(getLoginUserId(), RoleCodeEnum.CRM_ADMIN.getCode()); | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 构造 CRM 数据类型数据【分页】查询条件 | |
| 41 | + * | |
| 42 | + * @param query 连表查询对象 | |
| 43 | + * @param bizType 数据类型 {@link CrmBizTypeEnum} | |
| 44 | + * @param bizId 数据编号 | |
| 45 | + * @param userId 用户编号 | |
| 46 | + * @param sceneType 场景类型 | |
| 47 | + */ | |
| 48 | + public static <T extends MPJLambdaWrapper<?>, S> void appendPermissionCondition(T query, Integer bizType, SFunction<S, ?> bizId, | |
| 49 | + Long userId, Integer sceneType) { | |
| 50 | + MybatisPlusJoinProperties mybatisPlusJoinProperties = SpringUtil.getBean(MybatisPlusJoinProperties.class); | |
| 51 | + final String ownerUserIdField = mybatisPlusJoinProperties.getTableAlias() + ".owner_user_id"; | |
| 52 | + // 场景一:我负责的数据 | |
| 53 | + if (CrmSceneTypeEnum.isOwner(sceneType)) { | |
| 54 | + query.eq(ownerUserIdField, userId); | |
| 55 | + } | |
| 56 | + // 场景二:我参与的数据(我有读或写权限,并且不是负责人) | |
| 57 | + if (CrmSceneTypeEnum.isInvolved(sceneType)) { | |
| 58 | + if (CrmPermissionUtils.isCrmAdmin()) { // 特殊逻辑:如果是超管,直接查询所有,不过滤数据权限 | |
| 59 | + return; | |
| 60 | + } | |
| 61 | + query.innerJoin(CrmPermissionDO.class, on -> on.eq(CrmPermissionDO::getBizType, bizType) | |
| 62 | + .eq(CrmPermissionDO::getBizId, bizId) | |
| 63 | + .in(CrmPermissionDO::getLevel, CrmPermissionLevelEnum.READ.getLevel(), CrmPermissionLevelEnum.WRITE.getLevel()) | |
| 64 | + .eq(CrmPermissionDO::getUserId,userId)); | |
| 65 | + query.ne(ownerUserIdField, userId); | |
| 66 | + } | |
| 67 | + // 场景三:下属负责的数据(下属是负责人) | |
| 68 | + if (CrmSceneTypeEnum.isSubordinate(sceneType)) { | |
| 69 | + AdminUserApi adminUserApi = SpringUtil.getBean(AdminUserApi.class); | |
| 70 | + List<AdminUserRespDTO> subordinateUsers = adminUserApi.getUserListBySubordinate(userId); | |
| 71 | + if (CollUtil.isEmpty(subordinateUsers)) { | |
| 72 | + query.eq(ownerUserIdField, -1); // 不返回任何结果 | |
| 73 | + } else { | |
| 74 | + query.in(ownerUserIdField, convertSet(subordinateUsers, AdminUserRespDTO::getId)); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsCustomerMapper.xml renamed to yudao-module-crm/src/main/resources/mapper/statistics/CrmStatisticsCustomerMapper.xml
yudao-module-crm/src/main/resources/mapper/statistics/CrmStatisticsFunnelMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper"> | |
| 4 | + | |
| 5 | + <select id="selectCustomerCountByDate" resultType="java.lang.Long"> | |
| 6 | + SELECT | |
| 7 | + COUNT(*) | |
| 8 | + FROM crm_customer | |
| 9 | + WHERE deleted = 0 | |
| 10 | + AND owner_user_id IN | |
| 11 | + <!-- TODO @puhui999:这个 foreach 搞个缩进哈 - --> | |
| 12 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 13 | + #{userId} | |
| 14 | + </foreach> | |
| 15 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 16 | + <!-- TODO @puhui999:下面这个,就不缩进啦 - --> | |
| 17 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 18 | + </select> | |
| 19 | + | |
| 20 | + <select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long"> | |
| 21 | + SELECT | |
| 22 | + COUNT(*) | |
| 23 | + FROM crm_business | |
| 24 | + WHERE deleted = 0 | |
| 25 | + <if test="status != null"> | |
| 26 | + AND end_status = #{status} | |
| 27 | + </if> | |
| 28 | + AND owner_user_id IN | |
| 29 | + <foreach collection="reqVO.userIds" item="userId" open="(" close=")" separator=","> | |
| 30 | + #{userId} | |
| 31 | + </foreach> | |
| 32 | + AND create_time BETWEEN #{reqVO.times[0],javaType=java.time.LocalDateTime} AND | |
| 33 | + #{reqVO.times[1],javaType=java.time.LocalDateTime} | |
| 34 | + </select> | |
| 35 | + | |
| 36 | + <select id="selectBusinessSummaryListGroupByEndStatus" | |
| 37 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByEndStatusRespVO"> | |
| 38 | + SELECT | |
| 39 | + end_status AS endStatus, | |
| 40 | + COUNT(*) AS businessCount, | |
| 41 | + SUM(total_price) AS totalPrice | |
| 42 | + FROM crm_business | |
| 43 | + WHERE deleted = 0 AND end_status IS NOT NULL | |
| 44 | + AND owner_user_id IN | |
| 45 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 46 | + #{userId} | |
| 47 | + </foreach> | |
| 48 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 49 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 50 | + GROUP BY end_status | |
| 51 | + </select> | |
| 52 | + | |
| 53 | + <select id="selectBusinessSummaryGroupByDate" | |
| 54 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO"> | |
| 55 | + SELECT | |
| 56 | + DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 57 | + COUNT(*) AS businessCreateCount, | |
| 58 | + SUM(total_price) AS totalPrice | |
| 59 | + FROM crm_business | |
| 60 | + WHERE deleted = 0 | |
| 61 | + AND owner_user_id IN | |
| 62 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 63 | + #{userId} | |
| 64 | + </foreach> | |
| 65 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 66 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 67 | + GROUP BY time | |
| 68 | + </select> | |
| 69 | + | |
| 70 | + <select id="selectBusinessInversionRateSummaryByDate" | |
| 71 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO"> | |
| 72 | + SELECT | |
| 73 | + DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 74 | + COUNT(*) AS businessCount, | |
| 75 | + SUM(IF(end_status = 1, 1, 0)) AS businessWinCount | |
| 76 | + FROM crm_business | |
| 77 | + WHERE deleted = 0 | |
| 78 | + AND owner_user_id IN | |
| 79 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 80 | + #{userId} | |
| 81 | + </foreach> | |
| 82 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 83 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 84 | + GROUP BY time | |
| 85 | + </select> | |
| 86 | + | |
| 87 | +</mapper> | ... | ... |
yudao-module-crm/src/main/resources/mapper/statistics/CrmStatisticsPerformanceMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPerformanceMapper"> | |
| 4 | + | |
| 5 | + <select id="selectContractCountPerformance" | |
| 6 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 7 | + SELECT | |
| 8 | + DATE_FORMAT(order_date, '%Y%m') AS time, | |
| 9 | + COUNT(1) AS currentMonthCount | |
| 10 | + FROM crm_contract | |
| 11 | + WHERE deleted = 0 | |
| 12 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 13 | + AND owner_user_id in | |
| 14 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 15 | + #{userId} | |
| 16 | + </foreach> | |
| 17 | + AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | |
| 18 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 19 | + GROUP BY time | |
| 20 | + </select> | |
| 21 | + | |
| 22 | + <select id="selectContractPricePerformance" | |
| 23 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 24 | + SELECT | |
| 25 | + DATE_FORMAT(order_date, '%Y%m') AS time, | |
| 26 | + IFNULL(SUM(total_price), 0) AS currentMonthCount | |
| 27 | + FROM crm_contract | |
| 28 | + WHERE deleted = 0 | |
| 29 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 30 | + AND owner_user_id in | |
| 31 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 32 | + #{userId} | |
| 33 | + </foreach> | |
| 34 | + AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | |
| 35 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 36 | + GROUP BY time | |
| 37 | + </select> | |
| 38 | + | |
| 39 | + <select id="selectReceivablePricePerformance" | |
| 40 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 41 | + SELECT | |
| 42 | + DATE_FORMAT(return_time, '%Y%m') AS time, | |
| 43 | + IFNULL(SUM(price), 0) AS currentMonthCount | |
| 44 | + FROM crm_receivable | |
| 45 | + WHERE deleted = 0 | |
| 46 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 47 | + AND owner_user_id in | |
| 48 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 49 | + #{userId} | |
| 50 | + </foreach> | |
| 51 | + AND return_time between #{times[0],javaType=java.time.LocalDateTime} and | |
| 52 | + #{times[1],javaType=java.time.LocalDateTime} | |
| 53 | + GROUP BY time | |
| 54 | + </select> | |
| 55 | + | |
| 56 | +</mapper> | ... | ... |
yudao-module-crm/src/main/resources/mapper/statistics/CrmStatisticsPortraitMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPortraitMapper"> | |
| 4 | + | |
| 5 | + <select id="selectSummaryListGroupByAreaId" | |
| 6 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerAreaRespVO"> | |
| 7 | + SELECT area_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 8 | + FROM crm_customer | |
| 9 | + WHERE deleted = 0 AND area_id IS NOT NULL | |
| 10 | + AND owner_user_id IN | |
| 11 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 12 | + #{userId} | |
| 13 | + </foreach> | |
| 14 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 15 | + AND #{times[1],javaType=java.time.LocalDateTime} | |
| 16 | + GROUP BY area_id | |
| 17 | + </select> | |
| 18 | + | |
| 19 | + <select id="selectCustomerIndustryListGroupByIndustryId" | |
| 20 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerIndustryRespVO"> | |
| 21 | + SELECT industry_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 22 | + FROM crm_customer | |
| 23 | + WHERE deleted = 0 AND industry_id IS NOT NULL | |
| 24 | + AND owner_user_id IN | |
| 25 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 26 | + #{userId} | |
| 27 | + </foreach> | |
| 28 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 29 | + AND #{times[1],javaType=java.time.LocalDateTime} | |
| 30 | + GROUP BY industry_id | |
| 31 | + </select> | |
| 32 | + | |
| 33 | + <select id="selectCustomerSourceListGroupBySource" | |
| 34 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerSourceRespVO"> | |
| 35 | + SELECT source, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 36 | + FROM crm_customer | |
| 37 | + WHERE deleted = 0 AND source IS NOT NULL | |
| 38 | + AND owner_user_id IN | |
| 39 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 40 | + #{userId} | |
| 41 | + </foreach> | |
| 42 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 43 | + AND #{times[1],javaType=java.time.LocalDateTime} | |
| 44 | + GROUP BY source | |
| 45 | + </select> | |
| 46 | + | |
| 47 | + <select id="selectCustomerLevelListGroupByLevel" | |
| 48 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerLevelRespVO"> | |
| 49 | + SELECT level, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 50 | + FROM crm_customer | |
| 51 | + WHERE deleted = 0 AND level IS NOT NULL | |
| 52 | + AND owner_user_id IN | |
| 53 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 54 | + #{userId} | |
| 55 | + </foreach> | |
| 56 | + AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 57 | + AND #{times[1],javaType=java.time.LocalDateTime} | |
| 58 | + GROUP BY level | |
| 59 | + </select> | |
| 60 | + | |
| 61 | +</mapper> | ... | ... |
yudao-module-crm/src/main/resources/mapper/statistics/CrmStatisticsRankMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankMapper"> | |
| 4 | + | |
| 5 | + <select id="selectContractPriceRank" | |
| 6 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 7 | + SELECT IFNULL(SUM(total_price), 0) AS count, owner_user_id | |
| 8 | + FROM crm_contract | |
| 9 | + WHERE deleted = 0 | |
| 10 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 11 | + and owner_user_id in | |
| 12 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 13 | + #{userId} | |
| 14 | + </foreach> | |
| 15 | + AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 16 | + GROUP BY owner_user_id | |
| 17 | + </select> | |
| 18 | + | |
| 19 | + <select id="selectReceivablePriceRank" | |
| 20 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 21 | + SELECT IFNULL(SUM(price), 0) AS count, owner_user_id | |
| 22 | + FROM crm_receivable | |
| 23 | + WHERE deleted = 0 | |
| 24 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 25 | + AND owner_user_id in | |
| 26 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 27 | + #{userId} | |
| 28 | + </foreach> | |
| 29 | + AND return_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 30 | + GROUP BY owner_user_id | |
| 31 | + </select> | |
| 32 | + | |
| 33 | + <select id="selectContractCountRank" | |
| 34 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 35 | + SELECT COUNT(1) AS count, owner_user_id | |
| 36 | + FROM crm_contract | |
| 37 | + WHERE deleted = 0 | |
| 38 | + AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 39 | + AND owner_user_id in | |
| 40 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 41 | + #{userId} | |
| 42 | + </foreach> | |
| 43 | + AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 44 | + GROUP BY owner_user_id | |
| 45 | + </select> | |
| 46 | + | |
| 47 | + <select id="selectProductSalesRank" | |
| 48 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 49 | + SELECT COUNT(product.count) AS count, contract.owner_user_id | |
| 50 | + FROM crm_contract_product product | |
| 51 | + INNER JOIN crm_contract contract ON product.contract_id = contract.id | |
| 52 | + WHERE contract.deleted = 0 AND contract.deleted = 0 | |
| 53 | + AND contract.audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 54 | + AND contract.owner_user_id in | |
| 55 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 56 | + #{userId} | |
| 57 | + </foreach> | |
| 58 | + AND contract.order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 59 | + GROUP BY contract.owner_user_id | |
| 60 | + </select> | |
| 61 | + | |
| 62 | + <select id="selectCustomerCountRank" | |
| 63 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 64 | + SELECT COUNT(1) AS count, owner_user_id | |
| 65 | + FROM crm_customer | |
| 66 | + WHERE deleted = 0 | |
| 67 | + AND owner_user_id in | |
| 68 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 69 | + #{userId} | |
| 70 | + </foreach> | |
| 71 | + AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 72 | + GROUP BY owner_user_id | |
| 73 | + </select> | |
| 74 | + | |
| 75 | + <select id="selectContactsCountRank" | |
| 76 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 77 | + SELECT COUNT(1) AS count, owner_user_id | |
| 78 | + FROM crm_contact | |
| 79 | + WHERE deleted = 0 | |
| 80 | + AND owner_user_id in | |
| 81 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 82 | + #{userId} | |
| 83 | + </foreach> | |
| 84 | + AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 85 | + GROUP BY owner_user_id | |
| 86 | + </select> | |
| 87 | + | |
| 88 | + <select id="selectFollowCountRank" | |
| 89 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 90 | + SELECT COUNT(1) AS count, cc.owner_user_id | |
| 91 | + FROM crm_follow_up_record AS cfur | |
| 92 | + LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) | |
| 93 | + WHERE cfur.deleted = 0 | |
| 94 | + AND cc.deleted = 0 | |
| 95 | + AND cc.owner_user_id in | |
| 96 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 97 | + #{userId} | |
| 98 | + </foreach> | |
| 99 | + AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 100 | + GROUP BY cc.owner_user_id | |
| 101 | + </select> | |
| 102 | + | |
| 103 | + <select id="selectFollowCustomerCountRank" | |
| 104 | + resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 105 | + SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id | |
| 106 | + FROM crm_follow_up_record AS cfur | |
| 107 | + LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) | |
| 108 | + WHERE cfur.deleted = 0 | |
| 109 | + AND cc.deleted = 0 | |
| 110 | + AND cc.owner_user_id in | |
| 111 | + <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 112 | + #{userId} | |
| 113 | + </foreach> | |
| 114 | + AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 115 | + GROUP BY cc.owner_user_id | |
| 116 | + </select> | |
| 117 | + | |
| 118 | +</mapper> | ... | ... |
yudao-module-crm/src/test/resources/application-unit-test.yaml
0 → 100644
| 1 | +spring: | |
| 2 | + main: | |
| 3 | + lazy-initialization: true # 开启懒加载,加快速度 | |
| 4 | + banner-mode: off # 单元测试,禁用 Banner | |
| 5 | + | |
| 6 | +--- #################### 数据库相关配置 #################### | |
| 7 | + | |
| 8 | +spring: | |
| 9 | + # 数据源配置项 | |
| 10 | + datasource: | |
| 11 | + name: ruoyi-vue-pro | |
| 12 | + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写 | |
| 13 | + driver-class-name: org.h2.Driver | |
| 14 | + username: sa | |
| 15 | + password: | |
| 16 | + druid: | |
| 17 | + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 | |
| 18 | + initial-size: 1 # 单元测试,配置为 1,提升启动速度 | |
| 19 | + sql: | |
| 20 | + init: | |
| 21 | + schema-locations: classpath:/sql/create_tables.sql | |
| 22 | + | |
| 23 | + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | |
| 24 | + data: | |
| 25 | + redis: | |
| 26 | + host: 127.0.0.1 # 地址 | |
| 27 | + port: 16379 # 端口(单元测试,使用 16379 端口) | |
| 28 | + database: 0 # 数据库索引 | |
| 29 | + | |
| 30 | +mybatis-plus: | |
| 31 | + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 | |
| 32 | + type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject | |
| 33 | + | |
| 34 | +--- #################### 定时任务相关配置 #################### | |
| 35 | + | |
| 36 | +--- #################### 配置中心相关配置 #################### | |
| 37 | + | |
| 38 | +--- #################### 服务保障相关配置 #################### | |
| 39 | + | |
| 40 | +# Lock4j 配置项(单元测试,禁用 Lock4j) | |
| 41 | + | |
| 42 | +--- #################### 监控相关配置 #################### | |
| 43 | + | |
| 44 | +--- #################### 芋道相关配置 #################### | |
| 45 | + | |
| 46 | +# 芋道配置项,设置当前项目所有自定义的配置 | |
| 47 | +yudao: | |
| 48 | + info: | |
| 49 | + base-package: cn.iocoder.yudao | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/resources/logback.xml renamed to yudao-module-crm/src/test/resources/logback.xml
yudao-module-crm/yudao-module-crm-api/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-module-crm</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-module-crm-api</artifactId> | |
| 12 | - <packaging>jar</packaging> | |
| 13 | - | |
| 14 | - <name>${project.artifactId}</name> | |
| 15 | - <description> | |
| 16 | - crm 模块 API,暴露给其它模块调用 | |
| 17 | - </description> | |
| 18 | - | |
| 19 | - <dependencies> | |
| 20 | - <dependency> | |
| 21 | - <groupId>cn.iocoder.boot</groupId> | |
| 22 | - <artifactId>yudao-common</artifactId> | |
| 23 | - </dependency> | |
| 24 | - | |
| 25 | - <!-- 参数校验 --> | |
| 26 | - <dependency> | |
| 27 | - <groupId>org.springframework.boot</groupId> | |
| 28 | - <artifactId>spring-boot-starter-validation</artifactId> | |
| 29 | - <optional>true</optional> | |
| 30 | - </dependency> | |
| 31 | - </dependencies> | |
| 32 | - | |
| 33 | -</project> |
yudao-module-crm/yudao-module-crm-biz/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 3 | - xmlns="http://maven.apache.org/POM/4.0.0" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-module-crm</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-module-crm-biz</artifactId> | |
| 12 | - | |
| 13 | - <name>${project.artifactId}</name> | |
| 14 | - <description> | |
| 15 | - crm 包下,客户关系管理(Customer Relationship Management)。 | |
| 16 | - 例如说:客户、联系人、商机、合同、回款等等 | |
| 17 | - </description> | |
| 18 | - | |
| 19 | - <dependencies> | |
| 20 | - <dependency> | |
| 21 | - <groupId>cn.iocoder.boot</groupId> | |
| 22 | - <artifactId>yudao-module-system-api</artifactId> | |
| 23 | - <version>${revision}</version> | |
| 24 | - </dependency> | |
| 25 | - <dependency> | |
| 26 | - <groupId>cn.iocoder.boot</groupId> | |
| 27 | - <artifactId>yudao-module-infra-api</artifactId> | |
| 28 | - <version>${revision}</version> | |
| 29 | - </dependency> | |
| 30 | - <dependency> | |
| 31 | - <groupId>cn.iocoder.boot</groupId> | |
| 32 | - <artifactId>yudao-module-crm-api</artifactId> | |
| 33 | - <version>${revision}</version> | |
| 34 | - </dependency> | |
| 35 | - <dependency> | |
| 36 | - <groupId>cn.iocoder.boot</groupId> | |
| 37 | - <artifactId>yudao-module-bpm-api</artifactId> | |
| 38 | - <version>${revision}</version> | |
| 39 | - </dependency> | |
| 40 | - | |
| 41 | - <!-- 业务组件 --> | |
| 42 | - <dependency> | |
| 43 | - <groupId>cn.iocoder.boot</groupId> | |
| 44 | - <artifactId>yudao-spring-boot-starter-biz-ip</artifactId> | |
| 45 | - </dependency> | |
| 46 | - <dependency> | |
| 47 | - <groupId>cn.iocoder.boot</groupId> | |
| 48 | - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 49 | - </dependency> | |
| 50 | - | |
| 51 | - <!-- Web 相关 --> | |
| 52 | - <dependency> | |
| 53 | - <groupId>cn.iocoder.boot</groupId> | |
| 54 | - <artifactId>yudao-spring-boot-starter-web</artifactId> | |
| 55 | - </dependency> | |
| 56 | - | |
| 57 | - <dependency> | |
| 58 | - <groupId>cn.iocoder.boot</groupId> | |
| 59 | - <artifactId>yudao-spring-boot-starter-security</artifactId> | |
| 60 | - </dependency> | |
| 61 | - | |
| 62 | - <!-- DB 相关 --> | |
| 63 | - <dependency> | |
| 64 | - <groupId>cn.iocoder.boot</groupId> | |
| 65 | - <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | |
| 66 | - </dependency> | |
| 67 | - | |
| 68 | - <!-- 工具类相关 --> | |
| 69 | - <dependency> | |
| 70 | - <groupId>cn.iocoder.boot</groupId> | |
| 71 | - <artifactId>yudao-spring-boot-starter-excel</artifactId> | |
| 72 | - </dependency> | |
| 73 | - | |
| 74 | - <!-- Test 测试相关 --> | |
| 75 | - <dependency> | |
| 76 | - <groupId>cn.iocoder.boot</groupId> | |
| 77 | - <artifactId>yudao-spring-boot-starter-test</artifactId> | |
| 78 | - </dependency> | |
| 79 | - </dependencies> | |
| 80 | -</project> |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/web/package-info.java deleted
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/job/package-info.java deleted
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.business; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | |
| 8 | -import jakarta.validation.Valid; | |
| 9 | - | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | -import java.util.Map; | |
| 13 | - | |
| 14 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 商机状态 Service 接口 | |
| 18 | - * | |
| 19 | - * @author ljlleo | |
| 20 | - */ | |
| 21 | -public interface CrmBusinessStatusService { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 创建商机状态 | |
| 25 | - * | |
| 26 | - * @param createReqVO 创建信息 | |
| 27 | - * @return 编号 | |
| 28 | - */ | |
| 29 | - Long createBusinessStatus(@Valid CrmBusinessStatusSaveReqVO createReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 更新商机状态 | |
| 33 | - * | |
| 34 | - * @param updateReqVO 更新信息 | |
| 35 | - */ | |
| 36 | - void updateBusinessStatus(@Valid CrmBusinessStatusSaveReqVO updateReqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 删除商机状态 | |
| 40 | - * | |
| 41 | - * @param id 编号 | |
| 42 | - */ | |
| 43 | - void deleteBusinessStatusType(Long id); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 获得商机状态组 | |
| 47 | - * | |
| 48 | - * @param id 编号 | |
| 49 | - * @return 商机状态组 | |
| 50 | - */ | |
| 51 | - CrmBusinessStatusTypeDO getBusinessStatusType(Long id); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 校验商机状态组 | |
| 55 | - * | |
| 56 | - * @param id 编号 | |
| 57 | - */ | |
| 58 | - void validateBusinessStatusType(Long id); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得商机状态组列表 | |
| 62 | - * | |
| 63 | - * @return 商机状态组列表 | |
| 64 | - */ | |
| 65 | - List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获得商机状态组分页 | |
| 69 | - * | |
| 70 | - * @param pageReqVO 分页查询 | |
| 71 | - * @return 商机状态组分页 | |
| 72 | - */ | |
| 73 | - PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(PageParam pageReqVO); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 获得商机状态组列表 | |
| 77 | - * | |
| 78 | - * @param ids 编号数组 | |
| 79 | - * @return 商机状态组列表 | |
| 80 | - */ | |
| 81 | - List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids); | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 获得商机状态组 Map | |
| 85 | - * | |
| 86 | - * @param ids 编号数组 | |
| 87 | - * @return 商机状态组 Map | |
| 88 | - */ | |
| 89 | - default Map<Long, CrmBusinessStatusTypeDO> getBusinessStatusTypeMap(Collection<Long> ids) { | |
| 90 | - return convertMap(getBusinessStatusTypeList(ids), CrmBusinessStatusTypeDO::getId); | |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * 获得指定类型的商机状态列表 | |
| 95 | - * | |
| 96 | - * @param typeId 商机状态组编号 | |
| 97 | - * @return 商机状态列表 | |
| 98 | - */ | |
| 99 | - List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Long typeId); | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * 获得商机状态列表 | |
| 103 | - * | |
| 104 | - * @param ids 编号数组 | |
| 105 | - * @return 商机状态列表 | |
| 106 | - */ | |
| 107 | - List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids); | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * 获得商机状态 Map | |
| 111 | - * | |
| 112 | - * @param ids 编号数组 | |
| 113 | - * @return 商机状态 Map | |
| 114 | - */ | |
| 115 | - default Map<Long, CrmBusinessStatusDO> getBusinessStatusMap(Collection<Long> ids) { | |
| 116 | - return convertMap(getBusinessStatusList(ids), CrmBusinessStatusDO::getId); | |
| 117 | - } | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * 获得商机状态 | |
| 121 | - * | |
| 122 | - * @param id 编号 | |
| 123 | - * @return 商机状态 | |
| 124 | - */ | |
| 125 | - CrmBusinessStatusDO getBusinessStatus(Long id); | |
| 126 | - | |
| 127 | - /** | |
| 128 | - * 校验商机状态 | |
| 129 | - * | |
| 130 | - * @param statusTypeId 商机状态组编号 | |
| 131 | - * @param statusId 商机状态编号 | |
| 132 | - */ | |
| 133 | - CrmBusinessStatusDO validateBusinessStatus(Long statusTypeId, Long statusId); | |
| 134 | - | |
| 135 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.clue; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; | |
| 8 | -import jakarta.validation.Valid; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 线索 Service 接口 | |
| 14 | - * | |
| 15 | - * @author Wanwan | |
| 16 | - */ | |
| 17 | -public interface CrmClueService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建线索 | |
| 21 | - * | |
| 22 | - * @param createReqVO 创建信息 | |
| 23 | - * @return 编号 | |
| 24 | - */ | |
| 25 | - Long createClue(@Valid CrmClueSaveReqVO createReqVO); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 更新线索 | |
| 29 | - * | |
| 30 | - * @param updateReqVO 更新信息 | |
| 31 | - */ | |
| 32 | - void updateClue(@Valid CrmClueSaveReqVO updateReqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 更新线索相关的跟进信息 | |
| 36 | - * | |
| 37 | - * @param id 编号 | |
| 38 | - * @param contactNextTime 下次联系时间 | |
| 39 | - * @param contactLastContent 最后联系内容 | |
| 40 | - */ | |
| 41 | - void updateClueFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 删除线索 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - */ | |
| 48 | - void deleteClue(Long id); | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 获得线索 | |
| 52 | - * | |
| 53 | - * @param id 编号 | |
| 54 | - * @return 线索 | |
| 55 | - */ | |
| 56 | - CrmClueDO getClue(Long id); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 获得线索分页 | |
| 60 | - * | |
| 61 | - * @param pageReqVO 分页查询 | |
| 62 | - * @param userId 用户编号 | |
| 63 | - * @return 线索分页 | |
| 64 | - */ | |
| 65 | - PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 线索转移 | |
| 69 | - * | |
| 70 | - * @param reqVO 请求 | |
| 71 | - * @param userId 用户编号 | |
| 72 | - */ | |
| 73 | - void transferClue(CrmClueTransferReqVO reqVO, Long userId); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 线索转化为客户 | |
| 77 | - * | |
| 78 | - * @param id 线索编号 | |
| 79 | - * @param userId 用户编号 | |
| 80 | - */ | |
| 81 | - void transformClue(Long id, Long userId); | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 获得分配给我的、待跟进的线索数量 | |
| 85 | - * | |
| 86 | - * @param userId 用户编号 | |
| 87 | - * @return 数量 | |
| 88 | - */ | |
| 89 | - Long getFollowClueCount(Long userId); | |
| 90 | - | |
| 91 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactBusinessService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.contact; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusiness2ReqVO; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; | |
| 6 | -import jakarta.validation.Valid; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * CRM 联系人与商机的关联 Service 接口 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface CrmContactBusinessService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 创建联系人与商机的关联【通过联系人,关联商机】 | |
| 19 | - * | |
| 20 | - * @param createReqVO 创建信息 | |
| 21 | - */ | |
| 22 | - void createContactBusinessList(@Valid CrmContactBusinessReqVO createReqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 创建联系人与商机的关联【通过商机,关联联系人】 | |
| 26 | - * | |
| 27 | - * @param createReqVO 创建信息 | |
| 28 | - */ | |
| 29 | - void createContactBusinessList2(@Valid CrmContactBusiness2ReqVO createReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 删除联系人与商机的关联【通过联系人,取关商机】 | |
| 33 | - * | |
| 34 | - * @param deleteReqVO 删除信息 | |
| 35 | - */ | |
| 36 | - void deleteContactBusinessList(@Valid CrmContactBusinessReqVO deleteReqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 删除联系人与商机的关联【通过商机,取关联系人】 | |
| 40 | - * | |
| 41 | - * @param deleteReqVO 删除信息 | |
| 42 | - */ | |
| 43 | - void deleteContactBusinessList2(@Valid CrmContactBusiness2ReqVO deleteReqVO); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 删除联系人与商机的关联,基于联系人编号 | |
| 47 | - * | |
| 48 | - * @param contactId 联系人编号 | |
| 49 | - */ | |
| 50 | - void deleteContactBusinessByContactId(Long contactId); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 获得联系人与商机的关联列表,基于联系人编号 | |
| 54 | - * | |
| 55 | - * @param contactId 联系人编号 | |
| 56 | - * @return 联系人商机关联 | |
| 57 | - */ | |
| 58 | - List<CrmContactBusinessDO> getContactBusinessListByContactId(Long contactId); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得联系人与商机的关联列表,基于商机编号 | |
| 62 | - * | |
| 63 | - * @param businessId 商机编号 | |
| 64 | - * @return 联系人商机关联 | |
| 65 | - */ | |
| 66 | - List<CrmContactBusinessDO> getContactBusinessListByBusinessId(Long businessId); | |
| 67 | - | |
| 68 | -} | |
| 69 | 0 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractConfigServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.contract; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.config.CrmContractConfigSaveReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractConfigDO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractConfigMapper; | |
| 7 | -import com.mzt.logapi.context.LogRecordContext; | |
| 8 | -import com.mzt.logapi.starter.annotation.LogRecord; | |
| 9 | -import jakarta.annotation.Resource; | |
| 10 | -import org.springframework.stereotype.Service; | |
| 11 | -import org.springframework.validation.annotation.Validated; | |
| 12 | - | |
| 13 | -import java.util.Objects; | |
| 14 | - | |
| 15 | -import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 合同配置 Service 实现类 | |
| 19 | - * | |
| 20 | - * @author 芋道源码 | |
| 21 | - */ | |
| 22 | -@Service | |
| 23 | -@Validated | |
| 24 | -public class CrmContractConfigServiceImpl implements CrmContractConfigService { | |
| 25 | - | |
| 26 | - @Resource | |
| 27 | - private CrmContractConfigMapper contractConfigMapper; | |
| 28 | - | |
| 29 | - @Override | |
| 30 | - public CrmContractConfigDO getContractConfig() { | |
| 31 | - return contractConfigMapper.selectOne(); | |
| 32 | - } | |
| 33 | - | |
| 34 | - @Override | |
| 35 | - @LogRecord(type = CRM_CONTRACT_CONFIG_TYPE, subType = CRM_CONTRACT_CONFIG_SUB_TYPE, bizNo = "{{#configId}}", | |
| 36 | - success = CRM_CONTRACT_CONFIG_SUCCESS) | |
| 37 | - public void saveContractConfig(CrmContractConfigSaveReqVO saveReqVO) { | |
| 38 | - // 1. 存在,则进行更新 | |
| 39 | - CrmContractConfigDO dbConfig = getContractConfig(); | |
| 40 | - CrmContractConfigDO config = BeanUtils.toBean(saveReqVO, CrmContractConfigDO.class); | |
| 41 | - if (Objects.nonNull(dbConfig)) { | |
| 42 | - contractConfigMapper.updateById(config.setId(dbConfig.getId())); | |
| 43 | - // 记录操作日志上下文 | |
| 44 | - LogRecordContext.putVariable("isConfigUpdate", Boolean.TRUE); | |
| 45 | - LogRecordContext.putVariable("configId", config.getId()); | |
| 46 | - return; | |
| 47 | - } | |
| 48 | - | |
| 49 | - // 2. 不存在,则进行插入 | |
| 50 | - contractConfigMapper.insert(config); | |
| 51 | - // 记录操作日志上下文 | |
| 52 | - LogRecordContext.putVariable("isConfigUpdate", Boolean.FALSE); | |
| 53 | - LogRecordContext.putVariable("configId", config.getId()); | |
| 54 | - } | |
| 55 | - | |
| 56 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/listener/CrmContractStatusListener.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.contract.listener; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent; | |
| 4 | -import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener; | |
| 5 | -import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 6 | -import cn.iocoder.yudao.module.crm.service.contract.CrmContractServiceImpl; | |
| 7 | -import jakarta.annotation.Resource; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 合同审批的结果的监听器实现类 | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@Component | |
| 16 | -public class CrmContractStatusListener extends BpmProcessInstanceStatusEventListener { | |
| 17 | - | |
| 18 | - @Resource | |
| 19 | - private CrmContractService contractService; | |
| 20 | - | |
| 21 | - @Override | |
| 22 | - public String getProcessDefinitionKey() { | |
| 23 | - return CrmContractServiceImpl.BPM_PROCESS_DEFINITION_KEY; | |
| 24 | - } | |
| 25 | - | |
| 26 | - @Override | |
| 27 | - protected void onEvent(BpmProcessInstanceStatusEvent event) { | |
| 28 | - contractService.updateContractAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | |
| 29 | - } | |
| 30 | - | |
| 31 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | |
| 7 | -import jakarta.validation.Valid; | |
| 8 | - | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 客户限制配置 Service 接口 | |
| 13 | - * | |
| 14 | - * @author Wanwan | |
| 15 | - */ | |
| 16 | -public interface CrmCustomerLimitConfigService { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 创建客户限制配置 | |
| 20 | - * | |
| 21 | - * @param createReqVO 创建信息 | |
| 22 | - * @return 编号 | |
| 23 | - */ | |
| 24 | - Long createCustomerLimitConfig(@Valid CrmCustomerLimitConfigSaveReqVO createReqVO); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 更新客户限制配置 | |
| 28 | - * | |
| 29 | - * @param updateReqVO 更新信息 | |
| 30 | - */ | |
| 31 | - void updateCustomerLimitConfig(@Valid CrmCustomerLimitConfigSaveReqVO updateReqVO); | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 删除客户限制配置 | |
| 35 | - * | |
| 36 | - * @param id 编号 | |
| 37 | - */ | |
| 38 | - void deleteCustomerLimitConfig(Long id); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 获得客户限制配置 | |
| 42 | - * | |
| 43 | - * @param id 编号 | |
| 44 | - * @return 客户限制配置 | |
| 45 | - */ | |
| 46 | - CrmCustomerLimitConfigDO getCustomerLimitConfig(Long id); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得客户限制配置分页 | |
| 50 | - * | |
| 51 | - * @param pageReqVO 分页查询 | |
| 52 | - * @return 客户限制配置分页 | |
| 53 | - */ | |
| 54 | - PageResult<CrmCustomerLimitConfigDO> getCustomerLimitConfigPage(CrmCustomerLimitConfigPageReqVO pageReqVO); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 查询用户对应的配置列表 | |
| 58 | - * | |
| 59 | - * @param type 类型 | |
| 60 | - * @param userId 用户类型 | |
| 61 | - */ | |
| 62 | - List<CrmCustomerLimitConfigDO> getCustomerLimitConfigListByUserId(Integer type, Long userId); | |
| 63 | - | |
| 64 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper; | |
| 7 | -import com.mzt.logapi.context.LogRecordContext; | |
| 8 | -import com.mzt.logapi.starter.annotation.LogRecord; | |
| 9 | -import jakarta.annotation.Resource; | |
| 10 | -import org.springframework.stereotype.Service; | |
| 11 | -import org.springframework.validation.annotation.Validated; | |
| 12 | - | |
| 13 | -import java.util.Objects; | |
| 14 | - | |
| 15 | -import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 客户公海配置 Service 实现类 | |
| 19 | - * | |
| 20 | - * @author Wanwan | |
| 21 | - */ | |
| 22 | -@Service | |
| 23 | -@Validated | |
| 24 | -public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigService { | |
| 25 | - | |
| 26 | - @Resource | |
| 27 | - private CrmCustomerPoolConfigMapper customerPoolConfigMapper; | |
| 28 | - | |
| 29 | - @Override | |
| 30 | - public CrmCustomerPoolConfigDO getCustomerPoolConfig() { | |
| 31 | - return customerPoolConfigMapper.selectOne(); | |
| 32 | - } | |
| 33 | - | |
| 34 | - @Override | |
| 35 | - @LogRecord(type = CRM_CUSTOMER_POOL_CONFIG_TYPE, subType = CRM_CUSTOMER_POOL_CONFIG_SUB_TYPE, bizNo = "{{#poolConfigId}}", | |
| 36 | - success = CRM_CUSTOMER_POOL_CONFIG_SUCCESS) | |
| 37 | - public void saveCustomerPoolConfig(CrmCustomerPoolConfigSaveReqVO saveReqVO) { | |
| 38 | - // 1. 存在,则进行更新 | |
| 39 | - CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); | |
| 40 | - CrmCustomerPoolConfigDO poolConfig = BeanUtils.toBean(saveReqVO, CrmCustomerPoolConfigDO.class); | |
| 41 | - if (Objects.nonNull(dbConfig)) { | |
| 42 | - customerPoolConfigMapper.updateById(poolConfig.setId(dbConfig.getId())); | |
| 43 | - // 记录操作日志上下文 | |
| 44 | - LogRecordContext.putVariable("isPoolConfigUpdate", Boolean.TRUE); | |
| 45 | - LogRecordContext.putVariable("poolConfigId", poolConfig.getId()); | |
| 46 | - return; | |
| 47 | - } | |
| 48 | - | |
| 49 | - // 2. 不存在,则进行插入 | |
| 50 | - customerPoolConfigMapper.insert(poolConfig); | |
| 51 | - // 记录操作日志上下文 | |
| 52 | - LogRecordContext.putVariable("isPoolConfigUpdate", Boolean.FALSE); | |
| 53 | - LogRecordContext.putVariable("poolConfigId", poolConfig.getId()); | |
| 54 | - } | |
| 55 | - | |
| 56 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 6 | -import cn.iocoder.yudao.module.crm.service.customer.bo.CrmCustomerCreateReqBO; | |
| 7 | -import jakarta.validation.Valid; | |
| 8 | - | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | -import java.util.Map; | |
| 13 | - | |
| 14 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 客户 Service 接口 | |
| 18 | - * | |
| 19 | - * @author Wanwan | |
| 20 | - */ | |
| 21 | -public interface CrmCustomerService { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 创建客户 | |
| 25 | - * | |
| 26 | - * @param createReqVO 创建信息 | |
| 27 | - * @param userId 用户编号 | |
| 28 | - * @return 编号 | |
| 29 | - */ | |
| 30 | - Long createCustomer(@Valid CrmCustomerSaveReqVO createReqVO, Long userId); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 更新客户 | |
| 34 | - * | |
| 35 | - * @param updateReqVO 更新信息 | |
| 36 | - */ | |
| 37 | - void updateCustomer(@Valid CrmCustomerSaveReqVO updateReqVO); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 更新客户的跟进状态 | |
| 41 | - * | |
| 42 | - * @param id 编号 | |
| 43 | - * @param dealStatus 跟进状态 | |
| 44 | - */ | |
| 45 | - void updateCustomerDealStatus(Long id, Boolean dealStatus); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 更新客户相关的跟进信息 | |
| 49 | - * | |
| 50 | - * @param id 编号 | |
| 51 | - * @param contactNextTime 下次联系时间 | |
| 52 | - * @param contactLastContent 最后联系内容 | |
| 53 | - */ | |
| 54 | - void updateCustomerFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 删除客户 | |
| 58 | - * | |
| 59 | - * @param id 编号 | |
| 60 | - */ | |
| 61 | - void deleteCustomer(Long id); | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 获得客户 | |
| 65 | - * | |
| 66 | - * @param id 编号 | |
| 67 | - * @return 客户 | |
| 68 | - */ | |
| 69 | - CrmCustomerDO getCustomer(Long id); | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 获得客户列表 | |
| 73 | - * | |
| 74 | - * @param ids 客户编号数组 | |
| 75 | - * @return 客户列表 | |
| 76 | - * @author ljlleo | |
| 77 | - */ | |
| 78 | - List<CrmCustomerDO> getCustomerList(Collection<Long> ids); | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * 获得客户 Map | |
| 82 | - * | |
| 83 | - * @param ids 客户编号数组 | |
| 84 | - * @return 客户 Map | |
| 85 | - */ | |
| 86 | - default Map<Long, CrmCustomerDO> getCustomerMap(Collection<Long> ids) { | |
| 87 | - return convertMap(getCustomerList(ids), CrmCustomerDO::getId); | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * 获得客户分页 | |
| 92 | - * | |
| 93 | - * @param pageReqVO 分页查询 | |
| 94 | - * @param userId 用户编号 | |
| 95 | - * @return 客户分页 | |
| 96 | - */ | |
| 97 | - PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO, Long userId); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 获得放入公海提醒的客户分页 | |
| 101 | - * | |
| 102 | - * @param pageVO 分页查询 | |
| 103 | - * @param userId 用户编号 | |
| 104 | - * @return 客户分页 | |
| 105 | - */ | |
| 106 | - PageResult<CrmCustomerDO> getPutPoolRemindCustomerPage(CrmCustomerPageReqVO pageVO, Long userId); | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * 获得待进入公海的客户数量 | |
| 110 | - * | |
| 111 | - * @param userId 用户编号 | |
| 112 | - * @return 提醒数量 | |
| 113 | - */ | |
| 114 | - Long getPutPoolRemindCustomerCount(Long userId); | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * 获得今日需联系客户数量 | |
| 118 | - * | |
| 119 | - * @param userId 用户编号 | |
| 120 | - * @return 提醒数量 | |
| 121 | - */ | |
| 122 | - Long getTodayContactCustomerCount(Long userId); | |
| 123 | - | |
| 124 | - /** | |
| 125 | - * 获得分配给我的客户数量 | |
| 126 | - * | |
| 127 | - * @param userId 用户编号 | |
| 128 | - * @return 提醒数量 | |
| 129 | - */ | |
| 130 | - Long getFollowCustomerCount(Long userId); | |
| 131 | - | |
| 132 | - /** | |
| 133 | - * 校验客户是否存在 | |
| 134 | - * | |
| 135 | - * @param id 编号 | |
| 136 | - */ | |
| 137 | - void validateCustomer(Long id); | |
| 138 | - | |
| 139 | - /** | |
| 140 | - * 客户转移 | |
| 141 | - * | |
| 142 | - * @param reqVO 请求 | |
| 143 | - * @param userId 用户编号 | |
| 144 | - */ | |
| 145 | - void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId); | |
| 146 | - | |
| 147 | - /** | |
| 148 | - * 锁定/解锁客户 | |
| 149 | - * | |
| 150 | - * @param lockReqVO 更新信息 | |
| 151 | - * @param userId 用户编号 | |
| 152 | - */ | |
| 153 | - void lockCustomer(@Valid CrmCustomerLockReqVO lockReqVO, Long userId); | |
| 154 | - | |
| 155 | - /** | |
| 156 | - * 创建客户 | |
| 157 | - * | |
| 158 | - * @param customerCreateReq 请求信息 | |
| 159 | - * @param userId 用户编号 | |
| 160 | - * @return 客户列表 | |
| 161 | - */ | |
| 162 | - Long createCustomer(CrmCustomerCreateReqBO customerCreateReq, Long userId); | |
| 163 | - | |
| 164 | - /** | |
| 165 | - * 批量导入客户 | |
| 166 | - * | |
| 167 | - * @param importCustomers 导入客户列表 | |
| 168 | - * @param importReqVO 请求 | |
| 169 | - * @return 导入结果 | |
| 170 | - */ | |
| 171 | - CrmCustomerImportRespVO importCustomerList(List<CrmCustomerImportExcelVO> importCustomers, CrmCustomerImportReqVO importReqVO); | |
| 172 | - | |
| 173 | - // ==================== 公海相关操作 ==================== | |
| 174 | - | |
| 175 | - /** | |
| 176 | - * 客户放入公海 | |
| 177 | - * | |
| 178 | - * @param id 客户编号 | |
| 179 | - */ | |
| 180 | - void putCustomerPool(Long id); | |
| 181 | - | |
| 182 | - /** | |
| 183 | - * 领取公海客户 | |
| 184 | - * | |
| 185 | - * @param ids 要领取的客户编号数组 | |
| 186 | - * @param ownerUserId 负责人 | |
| 187 | - * @param isReceive 是/否领取;true - 领取;false - 分配 | |
| 188 | - */ | |
| 189 | - void receiveCustomer(List<Long> ids, Long ownerUserId, Boolean isReceive); | |
| 190 | - | |
| 191 | - /** | |
| 192 | - * 【系统】客户自动掉入公海 | |
| 193 | - * | |
| 194 | - * @return 掉入公海数量 | |
| 195 | - */ | |
| 196 | - int autoPutCustomerPool(); | |
| 197 | - | |
| 198 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/bo/CrmCustomerCreateReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.customer.bo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.validation.Mobile; | |
| 4 | -import cn.iocoder.yudao.framework.common.validation.Telephone; | |
| 5 | -import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | |
| 6 | -import jakarta.validation.constraints.Email; | |
| 7 | -import jakarta.validation.constraints.NotEmpty; | |
| 8 | -import jakarta.validation.constraints.Size; | |
| 9 | -import lombok.Data; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 客户创建 Create Req BO | |
| 15 | - * | |
| 16 | - * @author HUIHUI | |
| 17 | - */ | |
| 18 | -@Data | |
| 19 | -public class CrmCustomerCreateReqBO { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 客户名称 | |
| 23 | - */ | |
| 24 | - @NotEmpty(message = "客户名称不能为空") | |
| 25 | - private String name; | |
| 26 | - /** | |
| 27 | - * 跟进状态 | |
| 28 | - */ | |
| 29 | - private Boolean followUpStatus; | |
| 30 | - /** | |
| 31 | - * 锁定状态 | |
| 32 | - */ | |
| 33 | - private Boolean lockStatus; | |
| 34 | - /** | |
| 35 | - * 成交状态 | |
| 36 | - */ | |
| 37 | - private Boolean dealStatus; | |
| 38 | - /** | |
| 39 | - * 所属行业 | |
| 40 | - * | |
| 41 | - * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_INDUSTRY} | |
| 42 | - */ | |
| 43 | - private Integer industryId; | |
| 44 | - /** | |
| 45 | - * 客户等级 | |
| 46 | - * | |
| 47 | - * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_LEVEL} | |
| 48 | - */ | |
| 49 | - private Integer level; | |
| 50 | - /** | |
| 51 | - * 客户来源 | |
| 52 | - * | |
| 53 | - * 对应字典 {@link DictTypeConstants#CRM_CUSTOMER_SOURCE} | |
| 54 | - */ | |
| 55 | - private Integer source; | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 手机 | |
| 59 | - */ | |
| 60 | - @Mobile | |
| 61 | - private String mobile; | |
| 62 | - /** | |
| 63 | - * 电话 | |
| 64 | - */ | |
| 65 | - @Telephone | |
| 66 | - private String telephone; | |
| 67 | - /** | |
| 68 | ||
| 69 | - */ | |
| 70 | - private String qq; | |
| 71 | - /** | |
| 72 | ||
| 73 | - */ | |
| 74 | - private String wechat; | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 邮箱 | |
| 78 | - */ | |
| 79 | - @Email(message = "邮箱格式不正确") | |
| 80 | - private String email; | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * 客户描述 | |
| 84 | - */ | |
| 85 | - @Size(max = 4096, message = "客户描述长度不能超过 4096 个字符") | |
| 86 | - private String description; | |
| 87 | - /** | |
| 88 | - * 备注 | |
| 89 | - */ | |
| 90 | - private String remark; | |
| 91 | - /** | |
| 92 | - * 负责人的用户编号 | |
| 93 | - * | |
| 94 | - * 关联 AdminUserDO 的 id 字段 | |
| 95 | - */ | |
| 96 | - private Long ownerUserId; | |
| 97 | - /** | |
| 98 | - * 所在地 | |
| 99 | - * | |
| 100 | - * 关联 {@link cn.iocoder.yudao.framework.ip.core.Area#getId()} 字段 | |
| 101 | - */ | |
| 102 | - private Integer areaId; | |
| 103 | - /** | |
| 104 | - * 详细地址 | |
| 105 | - */ | |
| 106 | - private String detailAddress; | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * 最后跟进时间 | |
| 110 | - */ | |
| 111 | - private LocalDateTime contactLastTime; | |
| 112 | - /** | |
| 113 | - * 最后跟进内容 | |
| 114 | - */ | |
| 115 | - private String contactLastContent; | |
| 116 | - /** | |
| 117 | - * 下次联系时间 | |
| 118 | - */ | |
| 119 | - private LocalDateTime contactNextTime; | |
| 120 | - | |
| 121 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.followup; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.service.followup.bo.CrmFollowUpCreateReqBO; | |
| 8 | -import jakarta.validation.Valid; | |
| 9 | - | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 跟进记录 Service 接口 | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -public interface CrmFollowUpRecordService { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 创建跟进记录 (数据权限基于 bizType、 bizId) | |
| 22 | - * | |
| 23 | - * @param createReqVO 创建信息 | |
| 24 | - * @return 编号 | |
| 25 | - */ | |
| 26 | - Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO); | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 创建更进 | |
| 30 | - * | |
| 31 | - * @param list 请求 | |
| 32 | - */ | |
| 33 | - void createFollowUpRecordBatch(List<CrmFollowUpCreateReqBO> list); | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 删除跟进记录 (数据权限基于 bizType、 bizId) | |
| 37 | - * | |
| 38 | - * @param id 编号 | |
| 39 | - * @param userId 用户编号 | |
| 40 | - */ | |
| 41 | - void deleteFollowUpRecord(Long id, Long userId); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 删除跟进 | |
| 45 | - * | |
| 46 | - * @param bizType 模块类型 | |
| 47 | - * @param bizId 模块数据编号 | |
| 48 | - */ | |
| 49 | - void deleteFollowUpRecordByBiz(Integer bizType, Long bizId); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得跟进记录 | |
| 53 | - * | |
| 54 | - * @param id 编号 | |
| 55 | - * @return 跟进记录 | |
| 56 | - */ | |
| 57 | - CrmFollowUpRecordDO getFollowUpRecord(Long id); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得跟进记录分页 (数据权限基于 bizType、 bizId) | |
| 61 | - * | |
| 62 | - * @param pageReqVO 分页查询 | |
| 63 | - * @return 跟进记录分页 | |
| 64 | - */ | |
| 65 | - PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获取跟进记录 | |
| 69 | - * | |
| 70 | - * @param bizType 模块类型 | |
| 71 | - * @param bizIds 模块数据编号 | |
| 72 | - * @return 跟进列表 | |
| 73 | - */ | |
| 74 | - List<CrmFollowUpRecordDO> getFollowUpRecordByBiz(Integer bizType, Collection<Long> bizIds); | |
| 75 | - | |
| 76 | -} | |
| 77 | 0 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmFollowUpCreateReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.followup.bo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 4 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 5 | -import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; | |
| 6 | -import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 7 | -import jakarta.validation.constraints.NotEmpty; | |
| 8 | -import jakarta.validation.constraints.NotNull; | |
| 9 | -import lombok.Data; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 跟进信息 Create Req BO | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -@Data | |
| 20 | -public class CrmFollowUpCreateReqBO { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 数据类型 | |
| 24 | - * | |
| 25 | - * 枚举 {@link CrmBizTypeEnum} | |
| 26 | - */ | |
| 27 | - @NotNull(message = "数据类型不能为空") | |
| 28 | - private Integer bizType; | |
| 29 | - /** | |
| 30 | - * 数据编号 | |
| 31 | - * | |
| 32 | - * 关联 {@link CrmBizTypeEnum} 对应模块 DO 的 id 字段 | |
| 33 | - */ | |
| 34 | - @NotNull(message = "数据编号不能为空") | |
| 35 | - private Long bizId; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 跟进类型 | |
| 39 | - * | |
| 40 | - * 关联 {@link DictTypeConstants#CRM_FOLLOW_UP_TYPE} 字典 | |
| 41 | - */ | |
| 42 | - @NotNull(message = "跟进类型不能为空") | |
| 43 | - private Integer type; | |
| 44 | - /** | |
| 45 | - * 跟进内容 | |
| 46 | - */ | |
| 47 | - @NotEmpty(message = "跟进内容不能为空") | |
| 48 | - private String content; | |
| 49 | - /** | |
| 50 | - * 下次联系时间 | |
| 51 | - */ | |
| 52 | - @NotNull(message = "下次联系时间不能为空") | |
| 53 | - private LocalDateTime nextTime; | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 图片 | |
| 57 | - */ | |
| 58 | - private List<String> picUrls; | |
| 59 | - /** | |
| 60 | - * 附件 | |
| 61 | - */ | |
| 62 | - private List<String> fileUrls; | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 关联的商机编号数组 | |
| 66 | - * | |
| 67 | - * 关联 {@link CrmBusinessDO#getId()} | |
| 68 | - */ | |
| 69 | - private List<Long> businessIds; | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 关联的联系人编号数组 | |
| 73 | - * | |
| 74 | - * 关联 {@link CrmContactDO#getId()} | |
| 75 | - */ | |
| 76 | - private List<Long> contactIds; | |
| 77 | - | |
| 78 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.permission; | |
| 2 | - | |
| 3 | - | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionSaveReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionUpdateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 8 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 9 | -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | |
| 10 | -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | |
| 11 | -import jakarta.validation.Valid; | |
| 12 | - | |
| 13 | -import java.util.Collection; | |
| 14 | -import java.util.List; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * crm 数据权限 Service 接口 | |
| 18 | - * | |
| 19 | - * @author HUIHUI | |
| 20 | - */ | |
| 21 | -public interface CrmPermissionService { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 创建数据权限 | |
| 25 | - * | |
| 26 | - * @param reqVO 创建信息 | |
| 27 | - * @param userId 用户编号 | |
| 28 | - */ | |
| 29 | - void createPermission(CrmPermissionSaveReqVO reqVO, Long userId); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 创建数据权限 | |
| 33 | - * | |
| 34 | - * @param createReqBO 创建信息 | |
| 35 | - * @return 编号 | |
| 36 | - */ | |
| 37 | - Long createPermission(@Valid CrmPermissionCreateReqBO createReqBO); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 创建数据权限 | |
| 41 | - * | |
| 42 | - * @param createReqBOs 创建信息 | |
| 43 | - */ | |
| 44 | - void createPermissionBatch(@Valid List<CrmPermissionCreateReqBO> createReqBOs); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 更新数据权限 | |
| 48 | - * | |
| 49 | - * @param updateReqVO 更新信息 | |
| 50 | - */ | |
| 51 | - void updatePermission(CrmPermissionUpdateReqVO updateReqVO); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 数据权限转移 | |
| 55 | - * | |
| 56 | - * @param crmPermissionTransferReqBO 数据权限转移请求 | |
| 57 | - */ | |
| 58 | - void transferPermission(@Valid CrmPermissionTransferReqBO crmPermissionTransferReqBO); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 删除数据权限 | |
| 62 | - * | |
| 63 | - * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 64 | - * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 65 | - * @param level 数据权限级别,关联 {@link CrmPermissionLevelEnum} | |
| 66 | - */ | |
| 67 | - void deletePermission(Integer bizType, Long bizId, Integer level); | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * 删除数据权限 | |
| 71 | - * | |
| 72 | - * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 73 | - * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 74 | - */ | |
| 75 | - void deletePermission(Integer bizType, Long bizId); | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 批量删除数据权限 | |
| 79 | - * | |
| 80 | - * @param ids 权限编号 | |
| 81 | - * @param userId 用户编号 | |
| 82 | - */ | |
| 83 | - void deletePermissionBatch(Collection<Long> ids, Long userId); | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * 删除指定用户数据权限 | |
| 87 | - * | |
| 88 | - * @param id 权限编号 | |
| 89 | - * @param userId 用户编号 | |
| 90 | - */ | |
| 91 | - void deleteSelfPermission(Long id, Long userId); | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * 获取数据权限列表,通过 数据类型 x 某个数据 | |
| 95 | - * | |
| 96 | - * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 97 | - * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 98 | - * @return Crm 数据权限列表 | |
| 99 | - */ | |
| 100 | - List<CrmPermissionDO> getPermissionListByBiz(Integer bizType, Long bizId); | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * 获取数据权限列表,通过 数据类型 x 某个数据 | |
| 104 | - * | |
| 105 | - * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 106 | - * @param bizIds 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 107 | - * @return Crm 数据权限列表 | |
| 108 | - */ | |
| 109 | - List<CrmPermissionDO> getPermissionListByBiz(Integer bizType, Collection<Long> bizIds); | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * 获取用户参与的模块数据列表 | |
| 113 | - * | |
| 114 | - * @param bizType 模块类型 | |
| 115 | - * @param userId 用户编号 | |
| 116 | - * @return 模块数据列表 | |
| 117 | - */ | |
| 118 | - List<CrmPermissionDO> getPermissionListByBizTypeAndUserId(Integer bizType, Long userId); | |
| 119 | - | |
| 120 | - /** | |
| 121 | - * 校验是否有指定数据的操作权限 | |
| 122 | - * | |
| 123 | - * @param bizType 数据类型,关联 {@link CrmBizTypeEnum} | |
| 124 | - * @param bizId 数据编号,关联 {@link CrmBizTypeEnum} 对应模块 DO#getId() | |
| 125 | - * @param userId 用户编号 | |
| 126 | - * @param level 权限级别 | |
| 127 | - * @return 是否有权限 | |
| 128 | - */ | |
| 129 | - boolean hasPermission(Integer bizType, Long bizId, Long userId, CrmPermissionLevelEnum level); | |
| 130 | - | |
| 131 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/bo/CrmPermissionCreateReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.permission.bo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | -import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 5 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 6 | -import lombok.Data; | |
| 7 | - | |
| 8 | -import jakarta.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * crm 数据权限 Create Req BO | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@Data | |
| 16 | -public class CrmPermissionCreateReqBO { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 当前登录用户编号 | |
| 20 | - */ | |
| 21 | - @NotNull(message = "用户编号不能为空") | |
| 22 | - private Long userId; | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * Crm 类型 | |
| 26 | - */ | |
| 27 | - @NotNull(message = "Crm 类型不能为空") | |
| 28 | - @InEnum(CrmBizTypeEnum.class) | |
| 29 | - private Integer bizType; | |
| 30 | - /** | |
| 31 | - * 数据编号 | |
| 32 | - */ | |
| 33 | - @NotNull(message = "Crm 数据编号不能为空") | |
| 34 | - private Long bizId; | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 权限级别 | |
| 38 | - */ | |
| 39 | - @NotNull(message = "权限级别不能为空") | |
| 40 | - @InEnum(CrmPermissionLevelEnum.class) | |
| 41 | - private Integer level; | |
| 42 | - | |
| 43 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/bo/CrmPermissionTransferReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.permission.bo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | -import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 5 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 6 | -import lombok.AllArgsConstructor; | |
| 7 | -import lombok.Data; | |
| 8 | - | |
| 9 | -import jakarta.validation.constraints.NotNull; | |
| 10 | -import lombok.NoArgsConstructor; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 数据权限转移 Request BO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Data | |
| 18 | -@NoArgsConstructor | |
| 19 | -@AllArgsConstructor | |
| 20 | -public class CrmPermissionTransferReqBO { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 当前登录用户编号 | |
| 24 | - */ | |
| 25 | - @NotNull(message = "用户编号不能为空") | |
| 26 | - private Long userId; | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * CRM 类型 | |
| 30 | - */ | |
| 31 | - @NotNull(message = "Crm 类型不能为空") | |
| 32 | - @InEnum(CrmBizTypeEnum.class) | |
| 33 | - private Integer bizType; | |
| 34 | - /** | |
| 35 | - * 数据编号 | |
| 36 | - */ | |
| 37 | - @NotNull(message = "CRM 数据编号不能为空") | |
| 38 | - private Long bizId; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 新负责人的用户编号 | |
| 42 | - */ | |
| 43 | - @NotNull(message = "新负责人的用户编号不能为空") | |
| 44 | - private Long newOwnerUserId; | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 老负责人加入团队后的权限级别。如果 null 说明移除 | |
| 48 | - * | |
| 49 | - * 关联 {@link CrmPermissionLevelEnum} | |
| 50 | - */ | |
| 51 | - private Integer oldOwnerPermissionLevel; | |
| 52 | - | |
| 53 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryListReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | |
| 6 | -import jakarta.validation.Valid; | |
| 7 | - | |
| 8 | -import java.util.Collection; | |
| 9 | -import java.util.List; | |
| 10 | -import java.util.Map; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * CRM 产品分类 Service 接口 | |
| 16 | - * | |
| 17 | - * @author ZanGe丶 | |
| 18 | - */ | |
| 19 | -public interface CrmProductCategoryService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建产品分类 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createProductCategory(@Valid CrmProductCategoryCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新产品分类 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateProductCategory(@Valid CrmProductCategoryCreateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 删除产品分类 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - */ | |
| 41 | - void deleteProductCategory(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 获得产品分类 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - * @return 产品分类 | |
| 48 | - */ | |
| 49 | - CrmProductCategoryDO getProductCategory(Long id); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得产品分类列表 | |
| 53 | - * | |
| 54 | - * @param listReqVO 列表请求 | |
| 55 | - * @return 产品分类列表 | |
| 56 | - */ | |
| 57 | - List<CrmProductCategoryDO> getProductCategoryList(CrmProductCategoryListReqVO listReqVO); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得产品分类列表 | |
| 61 | - * | |
| 62 | - * @param ids 编号数组 | |
| 63 | - * @return 产品分类列表 | |
| 64 | - */ | |
| 65 | - List<CrmProductCategoryDO> getProductCategoryList(Collection<Long> ids); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获得产品分类 Map | |
| 69 | - * | |
| 70 | - * @param ids 编号数组 | |
| 71 | - * @return 产品分类 Map | |
| 72 | - */ | |
| 73 | - default Map<Long, CrmProductCategoryDO> getProductCategoryMap(Collection<Long> ids) { | |
| 74 | - return convertMap(getProductCategoryList(ids), CrmProductCategoryDO::getId); | |
| 75 | - } | |
| 76 | - | |
| 77 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.category.CrmProductCategoryListReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.mysql.product.CrmProductCategoryMapper; | |
| 8 | -import com.mzt.logapi.context.LogRecordContext; | |
| 9 | -import com.mzt.logapi.starter.annotation.LogRecord; | |
| 10 | -import jakarta.annotation.Resource; | |
| 11 | -import org.springframework.context.annotation.Lazy; | |
| 12 | -import org.springframework.stereotype.Service; | |
| 13 | -import org.springframework.validation.annotation.Validated; | |
| 14 | - | |
| 15 | -import java.util.Collection; | |
| 16 | -import java.util.List; | |
| 17 | -import java.util.Objects; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 20 | -import static cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO.PARENT_ID_NULL; | |
| 21 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | |
| 22 | -import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | |
| 23 | - | |
| 24 | -/** | |
| 25 | - * CRM 产品分类 Service 实现类 | |
| 26 | - * | |
| 27 | - * @author ZanGe丶 | |
| 28 | - */ | |
| 29 | -@Service | |
| 30 | -@Validated | |
| 31 | -public class CrmProductCategoryServiceImpl implements CrmProductCategoryService { | |
| 32 | - | |
| 33 | - @Resource(name = "crmProductCategoryMapper") | |
| 34 | - private CrmProductCategoryMapper productCategoryMapper; | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - @Lazy // 延迟加载,解决循环依赖问题 | |
| 38 | - private CrmProductService crmProductService; | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_CREATE_SUB_TYPE, bizNo = "{{#productCategoryId}}", | |
| 42 | - success = CRM_PRODUCT_CATEGORY_CREATE_SUCCESS) | |
| 43 | - public Long createProductCategory(CrmProductCategoryCreateReqVO createReqVO) { | |
| 44 | - // 1.1 校验父分类存在 | |
| 45 | - validateParentProductCategory(createReqVO.getParentId()); | |
| 46 | - // 1.2 分类名称是否存在 | |
| 47 | - validateProductNameExists(null, createReqVO.getParentId(), createReqVO.getName()); | |
| 48 | - | |
| 49 | - // 2. 插入分类 | |
| 50 | - CrmProductCategoryDO category = BeanUtils.toBean(createReqVO, CrmProductCategoryDO.class); | |
| 51 | - productCategoryMapper.insert(category); | |
| 52 | - | |
| 53 | - // 3. 记录操作日志上下文 | |
| 54 | - LogRecordContext.putVariable("productCategoryId", category.getId()); | |
| 55 | - return category.getId(); | |
| 56 | - } | |
| 57 | - | |
| 58 | - @Override | |
| 59 | - @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | |
| 60 | - success = CRM_PRODUCT_CATEGORY_UPDATE_SUCCESS) | |
| 61 | - public void updateProductCategory(CrmProductCategoryCreateReqVO updateReqVO) { | |
| 62 | - // 1.1 校验存在 | |
| 63 | - validateProductCategoryExists(updateReqVO.getId()); | |
| 64 | - // 1.2 校验父分类存在 | |
| 65 | - validateParentProductCategory(updateReqVO.getParentId()); | |
| 66 | - // 1.3 分类名称是否存在 | |
| 67 | - validateProductNameExists(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); | |
| 68 | - | |
| 69 | - // 2. 更新分类 | |
| 70 | - CrmProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, CrmProductCategoryDO.class); | |
| 71 | - productCategoryMapper.updateById(updateObj); | |
| 72 | - } | |
| 73 | - | |
| 74 | - private void validateProductCategoryExists(Long id) { | |
| 75 | - if (productCategoryMapper.selectById(id) == null) { | |
| 76 | - throw exception(PRODUCT_CATEGORY_NOT_EXISTS); | |
| 77 | - } | |
| 78 | - } | |
| 79 | - | |
| 80 | - private void validateParentProductCategory(Long id) { | |
| 81 | - // 如果是根分类,无需验证 | |
| 82 | - if (Objects.equals(id, PARENT_ID_NULL)) { | |
| 83 | - return; | |
| 84 | - } | |
| 85 | - // 父分类不存在 | |
| 86 | - CrmProductCategoryDO category = productCategoryMapper.selectById(id); | |
| 87 | - if (category == null) { | |
| 88 | - throw exception(PRODUCT_CATEGORY_PARENT_NOT_EXISTS); | |
| 89 | - } | |
| 90 | - // 父分类不能是二级分类 | |
| 91 | - if (!Objects.equals(category.getParentId(), PARENT_ID_NULL)) { | |
| 92 | - throw exception(PRODUCT_CATEGORY_PARENT_NOT_FIRST_LEVEL); | |
| 93 | - } | |
| 94 | - } | |
| 95 | - | |
| 96 | - private void validateProductNameExists(Long id, Long parentId, String name) { | |
| 97 | - CrmProductCategoryDO category = productCategoryMapper.selectByParentIdAndName(parentId, name); | |
| 98 | - if (category == null | |
| 99 | - || category.getId().equals(id)) { | |
| 100 | - return; | |
| 101 | - } | |
| 102 | - throw exception(PRODUCT_CATEGORY_EXISTS); | |
| 103 | - } | |
| 104 | - | |
| 105 | - @Override | |
| 106 | - @LogRecord(type = CRM_PRODUCT_CATEGORY_TYPE, subType = CRM_PRODUCT_CATEGORY_DELETE_SUB_TYPE, bizNo = "{{#id}}", | |
| 107 | - success = CRM_PRODUCT_CATEGORY_DELETE_SUCCESS) | |
| 108 | - public void deleteProductCategory(Long id) { | |
| 109 | - // 1.1 校验存在 | |
| 110 | - validateProductCategoryExists(id); | |
| 111 | - // 1.2 校验是否还有子分类 | |
| 112 | - if (productCategoryMapper.selectCountByParentId(id) > 0) { | |
| 113 | - throw exception(PRODUCT_CATEGORY_EXISTS_CHILDREN); | |
| 114 | - } | |
| 115 | - // 1.3 校验是否被产品使用 | |
| 116 | - if (crmProductService.getProductByCategoryId(id) > 0) { | |
| 117 | - throw exception(PRODUCT_CATEGORY_USED); | |
| 118 | - } | |
| 119 | - // 2. 删除 | |
| 120 | - productCategoryMapper.deleteById(id); | |
| 121 | - } | |
| 122 | - | |
| 123 | - @Override | |
| 124 | - public CrmProductCategoryDO getProductCategory(Long id) { | |
| 125 | - return productCategoryMapper.selectById(id); | |
| 126 | - } | |
| 127 | - | |
| 128 | - @Override | |
| 129 | - public List<CrmProductCategoryDO> getProductCategoryList(CrmProductCategoryListReqVO listReqVO) { | |
| 130 | - return productCategoryMapper.selectList(listReqVO); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Override | |
| 134 | - public List<CrmProductCategoryDO> getProductCategoryList(Collection<Long> ids) { | |
| 135 | - return productCategoryMapper.selectBatchIds(ids); | |
| 136 | - } | |
| 137 | - | |
| 138 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.product; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | |
| 7 | -import jakarta.validation.Valid; | |
| 8 | - | |
| 9 | -import java.util.Collection; | |
| 10 | -import java.util.List; | |
| 11 | -import java.util.Map; | |
| 12 | - | |
| 13 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * CRM 产品 Service 接口 | |
| 17 | - * | |
| 18 | - * @author ZanGe丶 | |
| 19 | - */ | |
| 20 | -public interface CrmProductService { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 创建产品 | |
| 24 | - * | |
| 25 | - * @param createReqVO 创建信息 | |
| 26 | - * @return 编号 | |
| 27 | - */ | |
| 28 | - Long createProduct(@Valid CrmProductSaveReqVO createReqVO); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 更新产品 | |
| 32 | - * | |
| 33 | - * @param updateReqVO 更新信息 | |
| 34 | - */ | |
| 35 | - void updateProduct(@Valid CrmProductSaveReqVO updateReqVO); | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 删除产品 | |
| 39 | - * | |
| 40 | - * @param id 编号 | |
| 41 | - */ | |
| 42 | - void deleteProduct(Long id); | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 获得产品 | |
| 46 | - * | |
| 47 | - * @param id 编号 | |
| 48 | - * @return 产品 | |
| 49 | - */ | |
| 50 | - CrmProductDO getProduct(Long id); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 获得产品列表 | |
| 54 | - * | |
| 55 | - * @param ids 编号 | |
| 56 | - * @return 产品列表 | |
| 57 | - */ | |
| 58 | - List<CrmProductDO> getProductList(Collection<Long> ids); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得产品 Map | |
| 62 | - * | |
| 63 | - * @param ids 编号 | |
| 64 | - * @return 产品 Map | |
| 65 | - */ | |
| 66 | - default Map<Long, CrmProductDO> getProductMap(Collection<Long> ids) { | |
| 67 | - return convertMap(getProductList(ids), CrmProductDO::getId); | |
| 68 | - } | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * 获得产品分页 | |
| 72 | - * | |
| 73 | - * @param pageReqVO 分页查询 | |
| 74 | - * @return 产品分页 | |
| 75 | - */ | |
| 76 | - PageResult<CrmProductDO> getProductPage(CrmProductPageReqVO pageReqVO); | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 获得产品数量 | |
| 80 | - * | |
| 81 | - * @param categoryId 分类编号 | |
| 82 | - * @return 产品 | |
| 83 | - */ | |
| 84 | - Long getProductByCategoryId(Long categoryId); | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * 获得指定状态的产品列表 | |
| 88 | - * | |
| 89 | - * @param status 状态 | |
| 90 | - * @return 产品列表 | |
| 91 | - */ | |
| 92 | - List<CrmProductDO> getProductListByStatus(Integer status); | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * 校验产品们的有效性 | |
| 96 | - * | |
| 97 | - * @param ids 编号数组 | |
| 98 | - * @return 产品列表 | |
| 99 | - */ | |
| 100 | - List<CrmProductDO> validProductList(Collection<Long> ids); | |
| 101 | - | |
| 102 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.receivable; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | |
| 8 | -import jakarta.validation.Valid; | |
| 9 | - | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * CRM 回款计划 Service 接口 | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -public interface CrmReceivablePlanService { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 创建回款计划 | |
| 22 | - * | |
| 23 | - * @param createReqVO 创建信息 | |
| 24 | - * @return 编号 | |
| 25 | - */ | |
| 26 | - Long createReceivablePlan(@Valid CrmReceivablePlanSaveReqVO createReqVO); | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 更新回款计划 | |
| 30 | - * | |
| 31 | - * @param updateReqVO 更新信息 | |
| 32 | - */ | |
| 33 | - void updateReceivablePlan(@Valid CrmReceivablePlanSaveReqVO updateReqVO); | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 更新回款计划关联的回款编号 | |
| 37 | - * | |
| 38 | - * @param id 编号 | |
| 39 | - * @param receivableId 回款编号 | |
| 40 | - */ | |
| 41 | - void updateReceivablePlanReceivableId(Long id, Long receivableId); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 删除回款计划 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - */ | |
| 48 | - void deleteReceivablePlan(Long id); | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 获得回款计划 | |
| 52 | - * | |
| 53 | - * @param id 编号 | |
| 54 | - * @return 回款计划 | |
| 55 | - */ | |
| 56 | - CrmReceivablePlanDO getReceivablePlan(Long id); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 获得回款计划列表 | |
| 60 | - * | |
| 61 | - * @param ids 编号 | |
| 62 | - * @return 回款计划列表 | |
| 63 | - */ | |
| 64 | - List<CrmReceivablePlanDO> getReceivablePlanList(Collection<Long> ids); | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * 获得回款计划分页 | |
| 68 | - * | |
| 69 | - * 数据权限:基于 {@link CrmReceivablePlanDO} 读取 | |
| 70 | - * | |
| 71 | - * @param pageReqVO 分页查询 | |
| 72 | - * @param userId 用户编号 | |
| 73 | - * @return 回款计划分页 | |
| 74 | - */ | |
| 75 | - PageResult<CrmReceivablePlanDO> getReceivablePlanPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId); | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 获得回款计划分页,基于指定客户 | |
| 79 | - * | |
| 80 | - * 数据权限:基于 {@link CrmCustomerDO} 读取 | |
| 81 | - * | |
| 82 | - * @param pageReqVO 分页查询 | |
| 83 | - * @return 回款计划分页 | |
| 84 | - */ | |
| 85 | - PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomerId(CrmReceivablePlanPageReqVO pageReqVO); | |
| 86 | - | |
| 87 | - /** | |
| 88 | - * 获得待回款提醒数量 | |
| 89 | - * | |
| 90 | - * @param userId 用户编号 | |
| 91 | - * @return 提醒数量 | |
| 92 | - */ | |
| 93 | - Long getReceivablePlanRemindCount(Long userId); | |
| 94 | - | |
| 95 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.receivable; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableSaveReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | |
| 8 | -import jakarta.validation.Valid; | |
| 9 | - | |
| 10 | -import java.math.BigDecimal; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Map; | |
| 14 | - | |
| 15 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * CRM 回款 Service 接口 | |
| 19 | - * | |
| 20 | - * @author 赤焰 | |
| 21 | - */ | |
| 22 | -public interface CrmReceivableService { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 创建回款 | |
| 26 | - * | |
| 27 | - * @param createReqVO 创建信息 | |
| 28 | - * @return 编号 | |
| 29 | - */ | |
| 30 | - Long createReceivable(@Valid CrmReceivableSaveReqVO createReqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 更新回款 | |
| 34 | - * | |
| 35 | - * @param updateReqVO 更新信息 | |
| 36 | - */ | |
| 37 | - void updateReceivable(@Valid CrmReceivableSaveReqVO updateReqVO); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 更新回款流程审批结果 | |
| 41 | - * | |
| 42 | - * @param id 回款编号 | |
| 43 | - * @param bpmResult BPM 审批结果 | |
| 44 | - */ | |
| 45 | - void updateReceivableAuditStatus(Long id, Integer bpmResult); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 删除回款 | |
| 49 | - * | |
| 50 | - * @param id 编号 | |
| 51 | - */ | |
| 52 | - void deleteReceivable(Long id); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 发起回款审批流程 | |
| 56 | - * | |
| 57 | - * @param id 回款编号 | |
| 58 | - * @param userId 用户编号 | |
| 59 | - */ | |
| 60 | - void submitReceivable(Long id, Long userId); | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * 获得回款 | |
| 64 | - * | |
| 65 | - * @param id 编号 | |
| 66 | - * @return 回款 | |
| 67 | - */ | |
| 68 | - CrmReceivableDO getReceivable(Long id); | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * 获得回款列表 | |
| 72 | - * | |
| 73 | - * @param ids 编号 | |
| 74 | - * @return 回款列表 | |
| 75 | - */ | |
| 76 | - List<CrmReceivableDO> getReceivableList(Collection<Long> ids); | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 获得回款 Map | |
| 80 | - * | |
| 81 | - * @param ids 编号 | |
| 82 | - * @return 回款 Map | |
| 83 | - */ | |
| 84 | - default Map<Long, CrmReceivableDO> getReceivableMap(Collection<Long> ids) { | |
| 85 | - return convertMap(getReceivableList(ids), CrmReceivableDO::getId); | |
| 86 | - } | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * 获得回款分页 | |
| 90 | - * | |
| 91 | - * 数据权限:基于 {@link CrmReceivableDO} 读取 | |
| 92 | - * | |
| 93 | - * @param pageReqVO 分页查询 | |
| 94 | - * @param userId 用户编号 | |
| 95 | - * @return 回款分页 | |
| 96 | - */ | |
| 97 | - PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO, Long userId); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 获得回款分页,基于指定客户 | |
| 101 | - * | |
| 102 | - * 数据权限:基于 {@link CrmCustomerDO} 读取 | |
| 103 | - * | |
| 104 | - * @param pageReqVO 分页查询 | |
| 105 | - * @return 回款分页 | |
| 106 | - */ | |
| 107 | - PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO); | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * 获得待审核回款数量 | |
| 111 | - * | |
| 112 | - * @param userId 用户编号 | |
| 113 | - * @return 待审批数量 | |
| 114 | - */ | |
| 115 | - Long getAuditReceivableCount(Long userId); | |
| 116 | - | |
| 117 | - /** | |
| 118 | - * 获得合同已回款金额 Map | |
| 119 | - * | |
| 120 | - * @param contractIds 合同编号 | |
| 121 | - * @return 回款金额 Map | |
| 122 | - */ | |
| 123 | - Map<Long, BigDecimal> getReceivablePriceMapByContractId(Collection<Long> contractIds); | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * 根据合同编号查询回款数量 | |
| 127 | - * | |
| 128 | - * @param contractId 合同编号 | |
| 129 | - * @return 回款数量 | |
| 130 | - */ | |
| 131 | - Long getReceivableCountByContractId(Long contractId); | |
| 132 | - | |
| 133 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/listener/CrmReceivableStatusListener.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.receivable.listener; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent; | |
| 4 | -import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener; | |
| 5 | -import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService; | |
| 6 | -import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableServiceImpl; | |
| 7 | -import jakarta.annotation.Resource; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 回款审批的结果的监听器实现类 | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@Component | |
| 16 | -public class CrmReceivableStatusListener extends BpmProcessInstanceStatusEventListener { | |
| 17 | - | |
| 18 | - @Resource | |
| 19 | - private CrmReceivableService receivableService; | |
| 20 | - | |
| 21 | - @Override | |
| 22 | - public String getProcessDefinitionKey() { | |
| 23 | - return CrmReceivableServiceImpl.BPM_PROCESS_DEFINITION_KEY; | |
| 24 | - } | |
| 25 | - | |
| 26 | - @Override | |
| 27 | - public void onEvent(BpmProcessInstanceStatusEvent event) { | |
| 28 | - receivableService.updateReceivableAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | |
| 29 | - } | |
| 30 | - | |
| 31 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsCustomerService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.customer.*; | |
| 4 | - | |
| 5 | -import java.util.List; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * CRM 客户分析 Service 接口 | |
| 9 | - * | |
| 10 | - * @author dhb52 | |
| 11 | - */ | |
| 12 | -public interface CrmStatisticsCustomerService { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * 总量分析(按日期) | |
| 16 | - * | |
| 17 | - * @param reqVO 请求参数 | |
| 18 | - * @return 统计数据 | |
| 19 | - */ | |
| 20 | - List<CrmStatisticsCustomerSummaryByDateRespVO> getCustomerSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 总量分析(按用户) | |
| 24 | - * | |
| 25 | - * @param reqVO 请求参数 | |
| 26 | - * @return 统计数据 | |
| 27 | - */ | |
| 28 | - List<CrmStatisticsCustomerSummaryByUserRespVO> getCustomerSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 跟进次数分析(按日期) | |
| 32 | - * | |
| 33 | - * @param reqVO 请求参数 | |
| 34 | - * @return 统计数据 | |
| 35 | - */ | |
| 36 | - List<CrmStatisticsFollowUpSummaryByDateRespVO> getFollowUpSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 跟进次数分析(按用户) | |
| 40 | - * | |
| 41 | - * @param reqVO 请求参数 | |
| 42 | - * @return 统计数据 | |
| 43 | - */ | |
| 44 | - List<CrmStatisticsFollowUpSummaryByUserRespVO> getFollowUpSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 客户跟进次数分析(按类型) | |
| 48 | - * | |
| 49 | - * @param reqVO 请求参数 | |
| 50 | - * @return 统计数据 | |
| 51 | - */ | |
| 52 | - List<CrmStatisticsFollowUpSummaryByTypeRespVO> getFollowUpSummaryByType(CrmStatisticsCustomerReqVO reqVO); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 获取客户的首次合同、回款信息列表,用于【客户转化率】页面 | |
| 56 | - * | |
| 57 | - * @param reqVO 请求参数 | |
| 58 | - * @return 统计数据 | |
| 59 | - */ | |
| 60 | - List<CrmStatisticsCustomerContractSummaryRespVO> getContractSummary(CrmStatisticsCustomerReqVO reqVO); | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * 公海客户分析(按日期) | |
| 64 | - * | |
| 65 | - * @param reqVO 请求参数 | |
| 66 | - * @return 统计数据 | |
| 67 | - */ | |
| 68 | - List<CrmStatisticsPoolSummaryByDateRespVO> getPoolSummaryByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * 公海客户分析(按用户) | |
| 72 | - * | |
| 73 | - * @param reqVO 请求参数 | |
| 74 | - * @return 统计数据 | |
| 75 | - */ | |
| 76 | - List<CrmStatisticsPoolSummaryByUserRespVO> getPoolSummaryByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 客户成交周期(按日期) | |
| 80 | - * | |
| 81 | - * 成交周期的定义:客户 customer 在创建出来,到合同 contract 第一次成交的时间差 | |
| 82 | - * | |
| 83 | - * @param reqVO 请求参数 | |
| 84 | - * @return 统计数据 | |
| 85 | - */ | |
| 86 | - List<CrmStatisticsCustomerDealCycleByDateRespVO> getCustomerDealCycleByDate(CrmStatisticsCustomerReqVO reqVO); | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * 客户成交周期(按用户) | |
| 90 | - * | |
| 91 | - * @param reqVO 请求参数 | |
| 92 | - * @return 统计数据 | |
| 93 | - */ | |
| 94 | - List<CrmStatisticsCustomerDealCycleByUserRespVO> getCustomerDealCycleByUser(CrmStatisticsCustomerReqVO reqVO); | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * 客户成交周期(按区域) | |
| 98 | - * | |
| 99 | - * @param reqVO 请求参数 | |
| 100 | - * @return 统计数据 | |
| 101 | - */ | |
| 102 | - List<CrmStatisticsCustomerDealCycleByAreaRespVO> getCustomerDealCycleByArea(CrmStatisticsCustomerReqVO reqVO); | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * 客户成交周期(按产品) | |
| 106 | - * | |
| 107 | - * @param reqVO 请求参数 | |
| 108 | - * @return 统计数据 | |
| 109 | - */ | |
| 110 | - List<CrmStatisticsCustomerDealCycleByProductRespVO> getCustomerDealCycleByProduct(CrmStatisticsCustomerReqVO reqVO); | |
| 111 | - | |
| 112 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsFunnelService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.*; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 6 | - | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * CRM 销售漏斗分析 Service | |
| 11 | - * | |
| 12 | - * @author HUIHUI | |
| 13 | - */ | |
| 14 | -public interface CrmStatisticsFunnelService { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 获得销售漏斗数据 | |
| 18 | - * | |
| 19 | - * @param reqVO 请求 | |
| 20 | - * @return 销售漏斗数据 | |
| 21 | - */ | |
| 22 | - CrmStatisticFunnelSummaryRespVO getFunnelSummary(CrmStatisticsFunnelReqVO reqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 获得商机结束状态统计 | |
| 26 | - * | |
| 27 | - * @param reqVO 请求 | |
| 28 | - * @return 商机结束状态统计 | |
| 29 | - */ | |
| 30 | - List<CrmStatisticsBusinessSummaryByEndStatusRespVO> getBusinessSummaryByEndStatus(CrmStatisticsFunnelReqVO reqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 获取新增商机分析(按日期) | |
| 34 | - * | |
| 35 | - * @param reqVO 请求 | |
| 36 | - * @return 新增商机分析 | |
| 37 | - */ | |
| 38 | - List<CrmStatisticsBusinessSummaryByDateRespVO> getBusinessSummaryByDate(CrmStatisticsFunnelReqVO reqVO); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 获得商机转化率分析(按日期) | |
| 42 | - * | |
| 43 | - * @param reqVO 请求 | |
| 44 | - * @return 商机转化率分析 | |
| 45 | - */ | |
| 46 | - List<CrmStatisticsBusinessInversionRateSummaryByDateRespVO> getBusinessInversionRateSummaryByDate(CrmStatisticsFunnelReqVO reqVO); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得商机分页(按日期) | |
| 50 | - * | |
| 51 | - * @param pageVO 请求 | |
| 52 | - * @return 商机分页 | |
| 53 | - */ | |
| 54 | - PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO); | |
| 55 | - | |
| 56 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | - | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * CRM 员工绩效统计 Service 接口 | |
| 12 | - * | |
| 13 | - * @author scholar | |
| 14 | - */ | |
| 15 | -public interface CrmStatisticsPerformanceService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 员工签约合同数量分析 | |
| 19 | - * | |
| 20 | - * @param performanceReqVO 排行参数 | |
| 21 | - * @return 员工签约合同数量排行分析 | |
| 22 | - */ | |
| 23 | - List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 员工签约合同金额分析 | |
| 27 | - * | |
| 28 | - * @param performanceReqVO 排行参数 | |
| 29 | - * @return 员工签约合同金额分析 | |
| 30 | - */ | |
| 31 | - List<CrmStatisticsPerformanceRespVO> getContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 员工获得回款金额分析 | |
| 35 | - * | |
| 36 | - * @param performanceReqVO 排行参数 | |
| 37 | - * @return 员工获得回款金额分析 | |
| 38 | - */ | |
| 39 | - List<CrmStatisticsPerformanceRespVO> getReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO); | |
| 40 | - | |
| 41 | - | |
| 42 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPerformanceServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | -import cn.hutool.core.util.ObjUtil; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceReqVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPerformanceMapper; | |
| 9 | -import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 10 | -import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 11 | -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 12 | -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 13 | -import jakarta.annotation.Resource; | |
| 14 | -import org.springframework.stereotype.Service; | |
| 15 | -import org.springframework.validation.annotation.Validated; | |
| 16 | - | |
| 17 | -import java.math.BigDecimal; | |
| 18 | -import java.util.ArrayList; | |
| 19 | -import java.util.Collections; | |
| 20 | -import java.util.List; | |
| 21 | -import java.util.Map; | |
| 22 | -import java.util.function.Function; | |
| 23 | - | |
| 24 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 25 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 26 | - | |
| 27 | -/** | |
| 28 | - * CRM 员工业绩分析 Service 实现类 | |
| 29 | - * | |
| 30 | - * @author scholar | |
| 31 | - */ | |
| 32 | -@Service | |
| 33 | -@Validated | |
| 34 | -public class CrmStatisticsPerformanceServiceImpl implements CrmStatisticsPerformanceService { | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - private CrmStatisticsPerformanceMapper performanceMapper; | |
| 38 | - | |
| 39 | - @Resource | |
| 40 | - private AdminUserApi adminUserApi; | |
| 41 | - @Resource | |
| 42 | - private DeptApi deptApi; | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - public List<CrmStatisticsPerformanceRespVO> getContractCountPerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 46 | - return getPerformance(performanceReqVO, performanceMapper::selectContractCountPerformance); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @Override | |
| 50 | - public List<CrmStatisticsPerformanceRespVO> getContractPricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 51 | - return getPerformance(performanceReqVO, performanceMapper::selectContractPricePerformance); | |
| 52 | - } | |
| 53 | - | |
| 54 | - @Override | |
| 55 | - public List<CrmStatisticsPerformanceRespVO> getReceivablePricePerformance(CrmStatisticsPerformanceReqVO performanceReqVO) { | |
| 56 | - return getPerformance(performanceReqVO, performanceMapper::selectReceivablePricePerformance); | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得员工业绩数据 | |
| 61 | - * | |
| 62 | - * 1. 获得今年 + 去年的数据 | |
| 63 | - * 2. 遍历今年的月份,逐个拼接去年的月份数据 | |
| 64 | - * | |
| 65 | - * @param performanceReqVO 参数 | |
| 66 | - * @param performanceFunction 员工业绩统计方法 | |
| 67 | - * @return 员工业绩数据 | |
| 68 | - */ | |
| 69 | - private List<CrmStatisticsPerformanceRespVO> getPerformance(CrmStatisticsPerformanceReqVO performanceReqVO, | |
| 70 | - Function<CrmStatisticsPerformanceReqVO, List<CrmStatisticsPerformanceRespVO>> performanceFunction) { | |
| 71 | - | |
| 72 | - // 1. 获得用户编号数组 | |
| 73 | - List<Long> userIds = getUserIds(performanceReqVO); | |
| 74 | - if (CollUtil.isEmpty(userIds)) { | |
| 75 | - return Collections.emptyList(); | |
| 76 | - } | |
| 77 | - performanceReqVO.setUserIds(userIds); | |
| 78 | - | |
| 79 | - // 2. 获得业绩数据 | |
| 80 | - int year = performanceReqVO.getTimes()[0].getYear(); // 获取查询的年份 | |
| 81 | - performanceReqVO.getTimes()[0] = performanceReqVO.getTimes()[0].minusYears(1); | |
| 82 | - List<CrmStatisticsPerformanceRespVO> performanceList = performanceFunction.apply(performanceReqVO); | |
| 83 | - Map<String, BigDecimal> performanceMap = convertMap(performanceList, CrmStatisticsPerformanceRespVO::getTime, | |
| 84 | - CrmStatisticsPerformanceRespVO::getCurrentMonthCount); | |
| 85 | - | |
| 86 | - // 3. 组装数据返回 | |
| 87 | - List<CrmStatisticsPerformanceRespVO> result = new ArrayList<>(); | |
| 88 | - for (int month = 1; month <= 12; month++) { | |
| 89 | - String currentMonth = String.format("%d%02d", year, month); | |
| 90 | - String lastMonth = month == 1 ? String.format("%d%02d", year - 1, 12) : String.format("%d%02d", year, month - 1); | |
| 91 | - String lastYear = String.format("%d%02d", year - 1, month); | |
| 92 | - result.add(new CrmStatisticsPerformanceRespVO().setTime(currentMonth) | |
| 93 | - .setCurrentMonthCount(performanceMap.getOrDefault(currentMonth, BigDecimal.ZERO)) | |
| 94 | - .setLastMonthCount(performanceMap.getOrDefault(lastMonth, BigDecimal.ZERO)) | |
| 95 | - .setLastYearCount(performanceMap.getOrDefault(lastYear, BigDecimal.ZERO))); | |
| 96 | - } | |
| 97 | - return result; | |
| 98 | - } | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * 获取用户编号数组。如果用户编号为空, 则获得部门下的用户编号数组,包括子部门的所有用户编号 | |
| 102 | - * | |
| 103 | - * @param reqVO 请求参数 | |
| 104 | - * @return 用户编号数组 | |
| 105 | - */ | |
| 106 | - private List<Long> getUserIds(CrmStatisticsPerformanceReqVO reqVO) { | |
| 107 | - // 情况一:选中某个用户 | |
| 108 | - if (ObjUtil.isNotNull(reqVO.getUserId())) { | |
| 109 | - return ListUtil.of(reqVO.getUserId()); | |
| 110 | - } | |
| 111 | - // 情况二:选中某个部门 | |
| 112 | - // 2.1 获得部门列表 | |
| 113 | - final Long deptId = reqVO.getDeptId(); | |
| 114 | - List<Long> deptIds = convertList(deptApi.getChildDeptList(deptId), DeptRespDTO::getId); | |
| 115 | - deptIds.add(deptId); | |
| 116 | - // 2.2 获得用户编号 | |
| 117 | - return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 118 | - } | |
| 119 | - | |
| 120 | -} | |
| 121 | 0 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPortraitService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*; | |
| 4 | - | |
| 5 | -import java.util.List; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * CRM 客户画像 Service 接口 | |
| 9 | - * | |
| 10 | - * @author HUIHUI | |
| 11 | - */ | |
| 12 | -public interface CrmStatisticsPortraitService { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * 获取客户地区统计数据 | |
| 16 | - * | |
| 17 | - * @param reqVO 请求参数 | |
| 18 | - * @return 统计数据 | |
| 19 | - */ | |
| 20 | - List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 获取客户行业统计数据 | |
| 24 | - * | |
| 25 | - * @param reqVO 请求参数 | |
| 26 | - * @return 统计数据 | |
| 27 | - */ | |
| 28 | - List<CrmStatisticCustomerIndustryRespVO> getCustomerSummaryByIndustry(CrmStatisticsPortraitReqVO reqVO); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 获取客户级别统计数据 | |
| 32 | - * | |
| 33 | - * @param reqVO 请求参数 | |
| 34 | - * @return 统计数据 | |
| 35 | - */ | |
| 36 | - List<CrmStatisticCustomerLevelRespVO> getCustomerSummaryByLevel(CrmStatisticsPortraitReqVO reqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 获取客户来源统计数据 | |
| 40 | - * | |
| 41 | - * @param reqVO 请求参数 | |
| 42 | - * @return 统计数据 | |
| 43 | - */ | |
| 44 | - List<CrmStatisticCustomerSourceRespVO> getCustomerSummaryBySource(CrmStatisticsPortraitReqVO reqVO); | |
| 45 | - | |
| 46 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsPortraitServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | -import cn.hutool.core.util.ObjUtil; | |
| 6 | -import cn.iocoder.yudao.framework.ip.core.Area; | |
| 7 | -import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; | |
| 8 | -import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.*; | |
| 10 | -import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPortraitMapper; | |
| 11 | -import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 12 | -import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 13 | -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 14 | -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 15 | -import jakarta.annotation.Resource; | |
| 16 | -import org.springframework.stereotype.Service; | |
| 17 | - | |
| 18 | -import java.util.Collections; | |
| 19 | -import java.util.List; | |
| 20 | -import java.util.Map; | |
| 21 | - | |
| 22 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 23 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * CRM 客户画像 Service 实现类 | |
| 27 | - * | |
| 28 | - * @author HUIHUI | |
| 29 | - */ | |
| 30 | -@Service | |
| 31 | -public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitService { | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - private CrmStatisticsPortraitMapper portraitMapper; | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - private AdminUserApi adminUserApi; | |
| 38 | - @Resource | |
| 39 | - private DeptApi deptApi; | |
| 40 | - | |
| 41 | - @Override | |
| 42 | - public List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO) { | |
| 43 | - // 1. 获得用户编号数组 | |
| 44 | - List<Long> userIds = getUserIds(reqVO); | |
| 45 | - if (CollUtil.isEmpty(userIds)) { | |
| 46 | - return Collections.emptyList(); | |
| 47 | - } | |
| 48 | - reqVO.setUserIds(userIds); | |
| 49 | - | |
| 50 | - // 2. 获取客户地区统计数据 | |
| 51 | - List<CrmStatisticCustomerAreaRespVO> list = portraitMapper.selectSummaryListGroupByAreaId(reqVO); | |
| 52 | - if (CollUtil.isEmpty(list)) { | |
| 53 | - return Collections.emptyList(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - // 3. 拼接数据 | |
| 57 | - List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area); | |
| 58 | - Map<Integer, Area> areaMap = convertMap(areaList, Area::getId); | |
| 59 | - return convertList(list, item -> { | |
| 60 | - Integer parentId = AreaUtils.getParentIdByType(item.getAreaId(), AreaTypeEnum.PROVINCE); | |
| 61 | - if (parentId != null) { | |
| 62 | - Area area = areaMap.get(parentId); | |
| 63 | - if (area != null) { | |
| 64 | - item.setAreaId(parentId).setAreaName(area.getName()); | |
| 65 | - return item; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - // 找不到,归到未知 | |
| 69 | - return item.setAreaId(null).setAreaName("未知"); | |
| 70 | - }); | |
| 71 | - } | |
| 72 | - | |
| 73 | - @Override | |
| 74 | - public List<CrmStatisticCustomerIndustryRespVO> getCustomerSummaryByIndustry(CrmStatisticsPortraitReqVO reqVO) { | |
| 75 | - // 1. 获得用户编号数组 | |
| 76 | - List<Long> userIds = getUserIds(reqVO); | |
| 77 | - if (CollUtil.isEmpty(userIds)) { | |
| 78 | - return Collections.emptyList(); | |
| 79 | - } | |
| 80 | - reqVO.setUserIds(userIds); | |
| 81 | - | |
| 82 | - // 2. 获取客户行业统计数据 | |
| 83 | - return portraitMapper.selectCustomerIndustryListGroupByIndustryId(reqVO); | |
| 84 | - } | |
| 85 | - | |
| 86 | - @Override | |
| 87 | - public List<CrmStatisticCustomerSourceRespVO> getCustomerSummaryBySource(CrmStatisticsPortraitReqVO reqVO) { | |
| 88 | - // 1. 获得用户编号数组 | |
| 89 | - List<Long> userIds = getUserIds(reqVO); | |
| 90 | - if (CollUtil.isEmpty(userIds)) { | |
| 91 | - return Collections.emptyList(); | |
| 92 | - } | |
| 93 | - reqVO.setUserIds(userIds); | |
| 94 | - | |
| 95 | - // 2. 获取客户行业统计数据 | |
| 96 | - return portraitMapper.selectCustomerSourceListGroupBySource(reqVO); | |
| 97 | - } | |
| 98 | - | |
| 99 | - @Override | |
| 100 | - public List<CrmStatisticCustomerLevelRespVO> getCustomerSummaryByLevel(CrmStatisticsPortraitReqVO reqVO) { | |
| 101 | - // 1. 获得用户编号数组 | |
| 102 | - List<Long> userIds = getUserIds(reqVO); | |
| 103 | - if (CollUtil.isEmpty(userIds)) { | |
| 104 | - return Collections.emptyList(); | |
| 105 | - } | |
| 106 | - reqVO.setUserIds(userIds); | |
| 107 | - | |
| 108 | - // 2. 获取客户级别统计数据 | |
| 109 | - return portraitMapper.selectCustomerLevelListGroupByLevel(reqVO); | |
| 110 | - } | |
| 111 | - | |
| 112 | - /** | |
| 113 | - * 获取用户编号数组。如果用户编号为空, 则获得部门下的用户编号数组,包括子部门的所有用户编号 | |
| 114 | - * | |
| 115 | - * @param reqVO 请求参数 | |
| 116 | - * @return 用户编号数组 | |
| 117 | - */ | |
| 118 | - private List<Long> getUserIds(CrmStatisticsPortraitReqVO reqVO) { | |
| 119 | - // 情况一:选中某个用户 | |
| 120 | - if (ObjUtil.isNotNull(reqVO.getUserId())) { | |
| 121 | - return ListUtil.of(reqVO.getUserId()); | |
| 122 | - } | |
| 123 | - // 情况二:选中某个部门 | |
| 124 | - // 2.1 获得部门列表 | |
| 125 | - List<Long> deptIds = convertList(deptApi.getChildDeptList(reqVO.getDeptId()), DeptRespDTO::getId); | |
| 126 | - deptIds.add(reqVO.getDeptId()); | |
| 127 | - // 2.2 获得用户编号 | |
| 128 | - return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 129 | - } | |
| 130 | - | |
| 131 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsRankService.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | - | |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankReqVO; | |
| 6 | - | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * CRM 排行榜统计 Service 接口 | |
| 11 | - * | |
| 12 | - * @author anhaohao | |
| 13 | - */ | |
| 14 | -public interface CrmStatisticsRankService { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 获得合同金额排行榜 | |
| 18 | - * | |
| 19 | - * @param rankReqVO 排行参数 | |
| 20 | - * @return 合同金额排行榜 | |
| 21 | - */ | |
| 22 | - List<CrmStatisticsRankRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 获得回款金额排行榜 | |
| 26 | - * | |
| 27 | - * @param rankReqVO 排行参数 | |
| 28 | - * @return 回款金额排行榜 | |
| 29 | - */ | |
| 30 | - List<CrmStatisticsRankRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 获得签约合同数量排行榜 | |
| 34 | - * | |
| 35 | - * @param rankReqVO 排行参数 | |
| 36 | - * @return 签约合同数量排行榜 | |
| 37 | - */ | |
| 38 | - List<CrmStatisticsRankRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 获得产品销量排行榜 | |
| 42 | - * | |
| 43 | - * @param rankReqVO 排行参数 | |
| 44 | - * @return 产品销量排行榜 | |
| 45 | - */ | |
| 46 | - List<CrmStatisticsRankRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得新增客户数排行榜 | |
| 50 | - * | |
| 51 | - * @param rankReqVO 排行参数 | |
| 52 | - * @return 新增客户数排行榜 | |
| 53 | - */ | |
| 54 | - List<CrmStatisticsRankRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 获得联系人数量排行榜 | |
| 58 | - * | |
| 59 | - * @param rankReqVO 排行参数 | |
| 60 | - * @return 联系人数量排行榜 | |
| 61 | - */ | |
| 62 | - List<CrmStatisticsRankRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 获得跟进次数排行榜 | |
| 66 | - * | |
| 67 | - * @param rankReqVO 排行参数 | |
| 68 | - * @return 跟进次数排行榜 | |
| 69 | - */ | |
| 70 | - List<CrmStatisticsRankRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * 获得跟进客户数排行榜 | |
| 74 | - * | |
| 75 | - * @param rankReqVO 排行参数 | |
| 76 | - * @return 跟进客户数排行榜 | |
| 77 | - */ | |
| 78 | - List<CrmStatisticsRankRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO); | |
| 79 | - | |
| 80 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/statistics/CrmStatisticsRankServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.service.statistics; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankReqVO; | |
| 6 | -import cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO; | |
| 7 | -import cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankMapper; | |
| 8 | -import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 9 | -import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | |
| 10 | -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 11 | -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 12 | -import jakarta.annotation.Resource; | |
| 13 | -import org.springframework.stereotype.Service; | |
| 14 | -import org.springframework.validation.annotation.Validated; | |
| 15 | - | |
| 16 | -import java.util.Collections; | |
| 17 | -import java.util.Comparator; | |
| 18 | -import java.util.List; | |
| 19 | -import java.util.Map; | |
| 20 | -import java.util.function.Function; | |
| 21 | - | |
| 22 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 23 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * CRM 排行榜统计 Service 实现类 | |
| 27 | - * | |
| 28 | - * @author anhaohao | |
| 29 | - */ | |
| 30 | -@Service | |
| 31 | -@Validated | |
| 32 | -public class CrmStatisticsRankServiceImpl implements CrmStatisticsRankService { | |
| 33 | - | |
| 34 | - @Resource | |
| 35 | - private CrmStatisticsRankMapper rankMapper; | |
| 36 | - | |
| 37 | - @Resource | |
| 38 | - private AdminUserApi adminUserApi; | |
| 39 | - @Resource | |
| 40 | - private DeptApi deptApi; | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public List<CrmStatisticsRankRespVO> getContractPriceRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 44 | - return getRank(rankReqVO, rankMapper::selectContractPriceRank); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @Override | |
| 48 | - public List<CrmStatisticsRankRespVO> getReceivablePriceRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 49 | - return getRank(rankReqVO, rankMapper::selectReceivablePriceRank); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @Override | |
| 53 | - public List<CrmStatisticsRankRespVO> getContractCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 54 | - return getRank(rankReqVO, rankMapper::selectContractCountRank); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Override | |
| 58 | - public List<CrmStatisticsRankRespVO> getProductSalesRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 59 | - return getRank(rankReqVO, rankMapper::selectProductSalesRank); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public List<CrmStatisticsRankRespVO> getCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 64 | - return getRank(rankReqVO, rankMapper::selectCustomerCountRank); | |
| 65 | - } | |
| 66 | - | |
| 67 | - @Override | |
| 68 | - public List<CrmStatisticsRankRespVO> getContactsCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 69 | - return getRank(rankReqVO, rankMapper::selectContactsCountRank); | |
| 70 | - } | |
| 71 | - | |
| 72 | - @Override | |
| 73 | - public List<CrmStatisticsRankRespVO> getFollowCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 74 | - return getRank(rankReqVO, rankMapper::selectFollowCountRank); | |
| 75 | - } | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public List<CrmStatisticsRankRespVO> getFollowCustomerCountRank(CrmStatisticsRankReqVO rankReqVO) { | |
| 79 | - return getRank(rankReqVO, rankMapper::selectFollowCustomerCountRank); | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * 获得排行版数据 | |
| 84 | - * | |
| 85 | - * @param rankReqVO 参数 | |
| 86 | - * @param rankFunction 排行榜方法 | |
| 87 | - * @return 排行版数据 | |
| 88 | - */ | |
| 89 | - private List<CrmStatisticsRankRespVO> getRank(CrmStatisticsRankReqVO rankReqVO, Function<CrmStatisticsRankReqVO, List<CrmStatisticsRankRespVO>> rankFunction) { | |
| 90 | - // 1. 获得用户编号数组 | |
| 91 | - rankReqVO.setUserIds(getUserIds(rankReqVO.getDeptId())); | |
| 92 | - if (CollUtil.isEmpty(rankReqVO.getUserIds())) { | |
| 93 | - return Collections.emptyList(); | |
| 94 | - } | |
| 95 | - // 2. 获得排行数据 | |
| 96 | - List<CrmStatisticsRankRespVO> ranks = rankFunction.apply(rankReqVO); | |
| 97 | - if (CollUtil.isEmpty(ranks)) { | |
| 98 | - return Collections.emptyList(); | |
| 99 | - } | |
| 100 | - ranks.sort(Comparator.comparing(CrmStatisticsRankRespVO::getCount).reversed()); | |
| 101 | - // 3. 拼接用户信息 | |
| 102 | - appendUserInfo(ranks); | |
| 103 | - return ranks; | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * 拼接用户信息(昵称、部门) | |
| 108 | - * | |
| 109 | - * @param ranks 排行榜数据 | |
| 110 | - */ | |
| 111 | - private void appendUserInfo(List<CrmStatisticsRankRespVO> ranks) { | |
| 112 | - Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(ranks, CrmStatisticsRankRespVO::getOwnerUserId)); | |
| 113 | - Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); | |
| 114 | - ranks.forEach(rank -> MapUtils.findAndThen(userMap, rank.getOwnerUserId(), user -> { | |
| 115 | - rank.setNickname(user.getNickname()); | |
| 116 | - MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> rank.setDeptName(dept.getName())); | |
| 117 | - })); | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | - * 获得部门下的用户编号数组,包括子部门的 | |
| 122 | - * | |
| 123 | - * @param deptId 部门编号 | |
| 124 | - * @return 用户编号数组 | |
| 125 | - */ | |
| 126 | - public List<Long> getUserIds(Long deptId) { | |
| 127 | - // 1. 获得部门列表 | |
| 128 | - List<Long> deptIds = convertList(deptApi.getChildDeptList(deptId), DeptRespDTO::getId); | |
| 129 | - deptIds.add(deptId); | |
| 130 | - // 2. 获得用户编号 | |
| 131 | - return convertList(adminUserApi.getUserListByDeptIds(deptIds), AdminUserRespDTO::getId); | |
| 132 | - } | |
| 133 | - | |
| 134 | -} | |
| 135 | 0 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmAuditStatusUtils.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.util; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; | |
| 5 | -import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * CRM 流程工具类 | |
| 9 | - * | |
| 10 | - * @author HUIHUI | |
| 11 | - */ | |
| 12 | -public class CrmAuditStatusUtils { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * BPM 审批结果转换 | |
| 16 | - * | |
| 17 | - * @param bpmResult BPM 审批结果 | |
| 18 | - */ | |
| 19 | - public static Integer convertBpmResultToAuditStatus(Integer bpmResult) { | |
| 20 | - Integer auditStatus = BpmTaskStatusEnum.APPROVE.getStatus().equals(bpmResult) ? CrmAuditStatusEnum.APPROVE.getStatus() | |
| 21 | - : BpmTaskStatusEnum.REJECT.getStatus().equals(bpmResult) ? CrmAuditStatusEnum.REJECT.getStatus() | |
| 22 | - : BpmTaskStatusEnum.CANCEL.getStatus().equals(bpmResult) ? BpmTaskStatusEnum.CANCEL.getStatus() : null; | |
| 23 | - Assert.notNull(auditStatus, "BPM 审批结果({}) 转换失败", bpmResult); | |
| 24 | - return auditStatus; | |
| 25 | - } | |
| 26 | - | |
| 27 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/util/CrmPermissionUtils.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.util; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.extra.spring.SpringUtil; | |
| 5 | -import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | |
| 6 | -import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | |
| 7 | -import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | |
| 8 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | |
| 9 | -import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | |
| 10 | -import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 11 | -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 12 | -import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; | |
| 13 | -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | |
| 14 | -import com.github.yulichang.autoconfigure.MybatisPlusJoinProperties; | |
| 15 | -import com.github.yulichang.wrapper.MPJLambdaWrapper; | |
| 16 | - | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 20 | -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * 数据权限工具类 | |
| 24 | - * | |
| 25 | - * @author HUIHUI | |
| 26 | - */ | |
| 27 | -public class CrmPermissionUtils { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 校验用户是否是 CRM 管理员 | |
| 31 | - * | |
| 32 | - * @return 是/否 | |
| 33 | - */ | |
| 34 | - public static boolean isCrmAdmin() { | |
| 35 | - PermissionApi permissionApi = SpringUtil.getBean(PermissionApi.class); | |
| 36 | - return permissionApi.hasAnyRoles(getLoginUserId(), RoleCodeEnum.CRM_ADMIN.getCode()); | |
| 37 | - } | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 构造 CRM 数据类型数据【分页】查询条件 | |
| 41 | - * | |
| 42 | - * @param query 连表查询对象 | |
| 43 | - * @param bizType 数据类型 {@link CrmBizTypeEnum} | |
| 44 | - * @param bizId 数据编号 | |
| 45 | - * @param userId 用户编号 | |
| 46 | - * @param sceneType 场景类型 | |
| 47 | - */ | |
| 48 | - public static <T extends MPJLambdaWrapper<?>, S> void appendPermissionCondition(T query, Integer bizType, SFunction<S, ?> bizId, | |
| 49 | - Long userId, Integer sceneType) { | |
| 50 | - MybatisPlusJoinProperties mybatisPlusJoinProperties = SpringUtil.getBean(MybatisPlusJoinProperties.class); | |
| 51 | - final String ownerUserIdField = mybatisPlusJoinProperties.getTableAlias() + ".owner_user_id"; | |
| 52 | - // 场景一:我负责的数据 | |
| 53 | - if (CrmSceneTypeEnum.isOwner(sceneType)) { | |
| 54 | - query.eq(ownerUserIdField, userId); | |
| 55 | - } | |
| 56 | - // 场景二:我参与的数据(我有读或写权限,并且不是负责人) | |
| 57 | - if (CrmSceneTypeEnum.isInvolved(sceneType)) { | |
| 58 | - if (CrmPermissionUtils.isCrmAdmin()) { // 特殊逻辑:如果是超管,直接查询所有,不过滤数据权限 | |
| 59 | - return; | |
| 60 | - } | |
| 61 | - query.innerJoin(CrmPermissionDO.class, on -> on.eq(CrmPermissionDO::getBizType, bizType) | |
| 62 | - .eq(CrmPermissionDO::getBizId, bizId) | |
| 63 | - .in(CrmPermissionDO::getLevel, CrmPermissionLevelEnum.READ.getLevel(), CrmPermissionLevelEnum.WRITE.getLevel()) | |
| 64 | - .eq(CrmPermissionDO::getUserId,userId)); | |
| 65 | - query.ne(ownerUserIdField, userId); | |
| 66 | - } | |
| 67 | - // 场景三:下属负责的数据(下属是负责人) | |
| 68 | - if (CrmSceneTypeEnum.isSubordinate(sceneType)) { | |
| 69 | - AdminUserApi adminUserApi = SpringUtil.getBean(AdminUserApi.class); | |
| 70 | - List<AdminUserRespDTO> subordinateUsers = adminUserApi.getUserListBySubordinate(userId); | |
| 71 | - if (CollUtil.isEmpty(subordinateUsers)) { | |
| 72 | - query.eq(ownerUserIdField, -1); // 不返回任何结果 | |
| 73 | - } else { | |
| 74 | - query.in(ownerUserIdField, convertSet(subordinateUsers, AdminUserRespDTO::getId)); | |
| 75 | - } | |
| 76 | - } | |
| 77 | - } | |
| 78 | - | |
| 79 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsFunnelMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsFunnelMapper"> | |
| 4 | - | |
| 5 | - <select id="selectCustomerCountByDate" resultType="java.lang.Long"> | |
| 6 | - SELECT | |
| 7 | - COUNT(*) | |
| 8 | - FROM crm_customer | |
| 9 | - WHERE deleted = 0 | |
| 10 | - AND owner_user_id IN | |
| 11 | - <!-- TODO @puhui999:这个 foreach 搞个缩进哈 - --> | |
| 12 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 13 | - #{userId} | |
| 14 | - </foreach> | |
| 15 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 16 | - <!-- TODO @puhui999:下面这个,就不缩进啦 - --> | |
| 17 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 18 | - </select> | |
| 19 | - | |
| 20 | - <select id="selectBusinessCountByDateAndEndStatus" resultType="java.lang.Long"> | |
| 21 | - SELECT | |
| 22 | - COUNT(*) | |
| 23 | - FROM crm_business | |
| 24 | - WHERE deleted = 0 | |
| 25 | - <if test="status != null"> | |
| 26 | - AND end_status = #{status} | |
| 27 | - </if> | |
| 28 | - AND owner_user_id IN | |
| 29 | - <foreach collection="reqVO.userIds" item="userId" open="(" close=")" separator=","> | |
| 30 | - #{userId} | |
| 31 | - </foreach> | |
| 32 | - AND create_time BETWEEN #{reqVO.times[0],javaType=java.time.LocalDateTime} AND | |
| 33 | - #{reqVO.times[1],javaType=java.time.LocalDateTime} | |
| 34 | - </select> | |
| 35 | - | |
| 36 | - <select id="selectBusinessSummaryListGroupByEndStatus" | |
| 37 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByEndStatusRespVO"> | |
| 38 | - SELECT | |
| 39 | - end_status AS endStatus, | |
| 40 | - COUNT(*) AS businessCount, | |
| 41 | - SUM(total_price) AS totalPrice | |
| 42 | - FROM crm_business | |
| 43 | - WHERE deleted = 0 AND end_status IS NOT NULL | |
| 44 | - AND owner_user_id IN | |
| 45 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 46 | - #{userId} | |
| 47 | - </foreach> | |
| 48 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 49 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 50 | - GROUP BY end_status | |
| 51 | - </select> | |
| 52 | - | |
| 53 | - <select id="selectBusinessSummaryGroupByDate" | |
| 54 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessSummaryByDateRespVO"> | |
| 55 | - SELECT | |
| 56 | - DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 57 | - COUNT(*) AS businessCreateCount, | |
| 58 | - SUM(total_price) AS totalPrice | |
| 59 | - FROM crm_business | |
| 60 | - WHERE deleted = 0 | |
| 61 | - AND owner_user_id IN | |
| 62 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 63 | - #{userId} | |
| 64 | - </foreach> | |
| 65 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 66 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 67 | - GROUP BY time | |
| 68 | - </select> | |
| 69 | - | |
| 70 | - <select id="selectBusinessInversionRateSummaryByDate" | |
| 71 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.funnel.CrmStatisticsBusinessInversionRateSummaryByDateRespVO"> | |
| 72 | - SELECT | |
| 73 | - DATE_FORMAT(create_time, '%Y-%m-%d') AS time, | |
| 74 | - COUNT(*) AS businessCount, | |
| 75 | - SUM(IF(end_status = 1, 1, 0)) AS businessWinCount | |
| 76 | - FROM crm_business | |
| 77 | - WHERE deleted = 0 | |
| 78 | - AND owner_user_id IN | |
| 79 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 80 | - #{userId} | |
| 81 | - </foreach> | |
| 82 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} AND | |
| 83 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 84 | - GROUP BY time | |
| 85 | - </select> | |
| 86 | - | |
| 87 | -</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsPerformanceMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPerformanceMapper"> | |
| 4 | - | |
| 5 | - <select id="selectContractCountPerformance" | |
| 6 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 7 | - SELECT | |
| 8 | - DATE_FORMAT(order_date, '%Y%m') AS time, | |
| 9 | - COUNT(1) AS currentMonthCount | |
| 10 | - FROM crm_contract | |
| 11 | - WHERE deleted = 0 | |
| 12 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 13 | - AND owner_user_id in | |
| 14 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 15 | - #{userId} | |
| 16 | - </foreach> | |
| 17 | - AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | |
| 18 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 19 | - GROUP BY time | |
| 20 | - </select> | |
| 21 | - | |
| 22 | - <select id="selectContractPricePerformance" | |
| 23 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 24 | - SELECT | |
| 25 | - DATE_FORMAT(order_date, '%Y%m') AS time, | |
| 26 | - IFNULL(SUM(total_price), 0) AS currentMonthCount | |
| 27 | - FROM crm_contract | |
| 28 | - WHERE deleted = 0 | |
| 29 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 30 | - AND owner_user_id in | |
| 31 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 32 | - #{userId} | |
| 33 | - </foreach> | |
| 34 | - AND order_date between #{times[0],javaType=java.time.LocalDateTime} and | |
| 35 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 36 | - GROUP BY time | |
| 37 | - </select> | |
| 38 | - | |
| 39 | - <select id="selectReceivablePricePerformance" | |
| 40 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.performance.CrmStatisticsPerformanceRespVO"> | |
| 41 | - SELECT | |
| 42 | - DATE_FORMAT(return_time, '%Y%m') AS time, | |
| 43 | - IFNULL(SUM(price), 0) AS currentMonthCount | |
| 44 | - FROM crm_receivable | |
| 45 | - WHERE deleted = 0 | |
| 46 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 47 | - AND owner_user_id in | |
| 48 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 49 | - #{userId} | |
| 50 | - </foreach> | |
| 51 | - AND return_time between #{times[0],javaType=java.time.LocalDateTime} and | |
| 52 | - #{times[1],javaType=java.time.LocalDateTime} | |
| 53 | - GROUP BY time | |
| 54 | - </select> | |
| 55 | - | |
| 56 | -</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsPortraitMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsPortraitMapper"> | |
| 4 | - | |
| 5 | - <select id="selectSummaryListGroupByAreaId" | |
| 6 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerAreaRespVO"> | |
| 7 | - SELECT area_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 8 | - FROM crm_customer | |
| 9 | - WHERE deleted = 0 AND area_id IS NOT NULL | |
| 10 | - AND owner_user_id IN | |
| 11 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 12 | - #{userId} | |
| 13 | - </foreach> | |
| 14 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 15 | - AND #{times[1],javaType=java.time.LocalDateTime} | |
| 16 | - GROUP BY area_id | |
| 17 | - </select> | |
| 18 | - | |
| 19 | - <select id="selectCustomerIndustryListGroupByIndustryId" | |
| 20 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerIndustryRespVO"> | |
| 21 | - SELECT industry_id, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 22 | - FROM crm_customer | |
| 23 | - WHERE deleted = 0 AND industry_id IS NOT NULL | |
| 24 | - AND owner_user_id IN | |
| 25 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 26 | - #{userId} | |
| 27 | - </foreach> | |
| 28 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 29 | - AND #{times[1],javaType=java.time.LocalDateTime} | |
| 30 | - GROUP BY industry_id | |
| 31 | - </select> | |
| 32 | - | |
| 33 | - <select id="selectCustomerSourceListGroupBySource" | |
| 34 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerSourceRespVO"> | |
| 35 | - SELECT source, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 36 | - FROM crm_customer | |
| 37 | - WHERE deleted = 0 AND source IS NOT NULL | |
| 38 | - AND owner_user_id IN | |
| 39 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 40 | - #{userId} | |
| 41 | - </foreach> | |
| 42 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 43 | - AND #{times[1],javaType=java.time.LocalDateTime} | |
| 44 | - GROUP BY source | |
| 45 | - </select> | |
| 46 | - | |
| 47 | - <select id="selectCustomerLevelListGroupByLevel" | |
| 48 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.portrait.CrmStatisticCustomerLevelRespVO"> | |
| 49 | - SELECT level, COUNT(*) AS customerCount, SUM(deal_status) AS dealCount | |
| 50 | - FROM crm_customer | |
| 51 | - WHERE deleted = 0 AND level IS NOT NULL | |
| 52 | - AND owner_user_id IN | |
| 53 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 54 | - #{userId} | |
| 55 | - </foreach> | |
| 56 | - AND create_time BETWEEN #{times[0],javaType=java.time.LocalDateTime} | |
| 57 | - AND #{times[1],javaType=java.time.LocalDateTime} | |
| 58 | - GROUP BY level | |
| 59 | - </select> | |
| 60 | - | |
| 61 | -</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/statistics/CrmStatisticsRankMapper.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | -<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.statistics.CrmStatisticsRankMapper"> | |
| 4 | - | |
| 5 | - <select id="selectContractPriceRank" | |
| 6 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 7 | - SELECT IFNULL(SUM(total_price), 0) AS count, owner_user_id | |
| 8 | - FROM crm_contract | |
| 9 | - WHERE deleted = 0 | |
| 10 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 11 | - and owner_user_id in | |
| 12 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 13 | - #{userId} | |
| 14 | - </foreach> | |
| 15 | - AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 16 | - GROUP BY owner_user_id | |
| 17 | - </select> | |
| 18 | - | |
| 19 | - <select id="selectReceivablePriceRank" | |
| 20 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 21 | - SELECT IFNULL(SUM(price), 0) AS count, owner_user_id | |
| 22 | - FROM crm_receivable | |
| 23 | - WHERE deleted = 0 | |
| 24 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 25 | - AND owner_user_id in | |
| 26 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 27 | - #{userId} | |
| 28 | - </foreach> | |
| 29 | - AND return_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 30 | - GROUP BY owner_user_id | |
| 31 | - </select> | |
| 32 | - | |
| 33 | - <select id="selectContractCountRank" | |
| 34 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 35 | - SELECT COUNT(1) AS count, owner_user_id | |
| 36 | - FROM crm_contract | |
| 37 | - WHERE deleted = 0 | |
| 38 | - AND audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 39 | - AND owner_user_id in | |
| 40 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 41 | - #{userId} | |
| 42 | - </foreach> | |
| 43 | - AND order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 44 | - GROUP BY owner_user_id | |
| 45 | - </select> | |
| 46 | - | |
| 47 | - <select id="selectProductSalesRank" | |
| 48 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 49 | - SELECT COUNT(product.count) AS count, contract.owner_user_id | |
| 50 | - FROM crm_contract_product product | |
| 51 | - INNER JOIN crm_contract contract ON product.contract_id = contract.id | |
| 52 | - WHERE contract.deleted = 0 AND contract.deleted = 0 | |
| 53 | - AND contract.audit_status = ${@cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum@APPROVE.status} | |
| 54 | - AND contract.owner_user_id in | |
| 55 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 56 | - #{userId} | |
| 57 | - </foreach> | |
| 58 | - AND contract.order_date between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 59 | - GROUP BY contract.owner_user_id | |
| 60 | - </select> | |
| 61 | - | |
| 62 | - <select id="selectCustomerCountRank" | |
| 63 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 64 | - SELECT COUNT(1) AS count, owner_user_id | |
| 65 | - FROM crm_customer | |
| 66 | - WHERE deleted = 0 | |
| 67 | - AND owner_user_id in | |
| 68 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 69 | - #{userId} | |
| 70 | - </foreach> | |
| 71 | - AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 72 | - GROUP BY owner_user_id | |
| 73 | - </select> | |
| 74 | - | |
| 75 | - <select id="selectContactsCountRank" | |
| 76 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 77 | - SELECT COUNT(1) AS count, owner_user_id | |
| 78 | - FROM crm_contact | |
| 79 | - WHERE deleted = 0 | |
| 80 | - AND owner_user_id in | |
| 81 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 82 | - #{userId} | |
| 83 | - </foreach> | |
| 84 | - AND create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 85 | - GROUP BY owner_user_id | |
| 86 | - </select> | |
| 87 | - | |
| 88 | - <select id="selectFollowCountRank" | |
| 89 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 90 | - SELECT COUNT(1) AS count, cc.owner_user_id | |
| 91 | - FROM crm_follow_up_record AS cfur | |
| 92 | - LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) | |
| 93 | - WHERE cfur.deleted = 0 | |
| 94 | - AND cc.deleted = 0 | |
| 95 | - AND cc.owner_user_id in | |
| 96 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 97 | - #{userId} | |
| 98 | - </foreach> | |
| 99 | - AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 100 | - GROUP BY cc.owner_user_id | |
| 101 | - </select> | |
| 102 | - | |
| 103 | - <select id="selectFollowCustomerCountRank" | |
| 104 | - resultType="cn.iocoder.yudao.module.crm.controller.admin.statistics.vo.rank.CrmStatisticsRankRespVO"> | |
| 105 | - SELECT COUNT(DISTINCT cc.id) AS count, cc.owner_user_id | |
| 106 | - FROM crm_follow_up_record AS cfur | |
| 107 | - LEFT JOIN crm_contact AS cc ON FIND_IN_SET(cc.id, cfur.contact_ids) | |
| 108 | - WHERE cfur.deleted = 0 | |
| 109 | - AND cc.deleted = 0 | |
| 110 | - AND cc.owner_user_id in | |
| 111 | - <foreach collection="userIds" item="userId" open="(" close=")" separator=","> | |
| 112 | - #{userId} | |
| 113 | - </foreach> | |
| 114 | - AND cfur.create_time between #{times[0],javaType=java.time.LocalDateTime} and #{times[1],javaType=java.time.LocalDateTime} | |
| 115 | - GROUP BY cc.owner_user_id | |
| 116 | - </select> | |
| 117 | - | |
| 118 | -</mapper> |
yudao-module-crm/yudao-module-crm-biz/src/test/resources/application-unit-test.yaml deleted
| 1 | -spring: | |
| 2 | - main: | |
| 3 | - lazy-initialization: true # 开启懒加载,加快速度 | |
| 4 | - banner-mode: off # 单元测试,禁用 Banner | |
| 5 | - | |
| 6 | ---- #################### 数据库相关配置 #################### | |
| 7 | - | |
| 8 | -spring: | |
| 9 | - # 数据源配置项 | |
| 10 | - datasource: | |
| 11 | - name: ruoyi-vue-pro | |
| 12 | - url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写 | |
| 13 | - driver-class-name: org.h2.Driver | |
| 14 | - username: sa | |
| 15 | - password: | |
| 16 | - druid: | |
| 17 | - async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 | |
| 18 | - initial-size: 1 # 单元测试,配置为 1,提升启动速度 | |
| 19 | - sql: | |
| 20 | - init: | |
| 21 | - schema-locations: classpath:/sql/create_tables.sql | |
| 22 | - | |
| 23 | - # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | |
| 24 | - data: | |
| 25 | - redis: | |
| 26 | - host: 127.0.0.1 # 地址 | |
| 27 | - port: 16379 # 端口(单元测试,使用 16379 端口) | |
| 28 | - database: 0 # 数据库索引 | |
| 29 | - | |
| 30 | -mybatis-plus: | |
| 31 | - lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 | |
| 32 | - type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject | |
| 33 | - | |
| 34 | ---- #################### 定时任务相关配置 #################### | |
| 35 | - | |
| 36 | ---- #################### 配置中心相关配置 #################### | |
| 37 | - | |
| 38 | ---- #################### 服务保障相关配置 #################### | |
| 39 | - | |
| 40 | -# Lock4j 配置项(单元测试,禁用 Lock4j) | |
| 41 | - | |
| 42 | ---- #################### 监控相关配置 #################### | |
| 43 | - | |
| 44 | ---- #################### 芋道相关配置 #################### | |
| 45 | - | |
| 46 | -# 芋道配置项,设置当前项目所有自定义的配置 | |
| 47 | -yudao: | |
| 48 | - info: | |
| 49 | - base-package: cn.iocoder.yudao |
yudao-server/pom.xml
| ... | ... | @@ -46,11 +46,11 @@ |
| 46 | 46 | <!-- <version>${revision}</version>--> |
| 47 | 47 | <!-- </dependency>--> |
| 48 | 48 | <!-- 工作流。默认注释,保证编译速度 --> |
| 49 | -<!-- <dependency>--> | |
| 50 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | |
| 51 | -<!-- <artifactId>yudao-module-bpm-biz</artifactId>--> | |
| 52 | -<!-- <version>${revision}</version>--> | |
| 53 | -<!-- </dependency>--> | |
| 49 | + <dependency> | |
| 50 | + <groupId>cn.iocoder.boot</groupId> | |
| 51 | + <artifactId>yudao-module-bpm</artifactId> | |
| 52 | + <version>${revision}</version> | |
| 53 | + </dependency> | |
| 54 | 54 | <!-- 支付服务。默认注释,保证编译速度 --> |
| 55 | 55 | <!-- <dependency>--> |
| 56 | 56 | <!-- <groupId>cn.iocoder.boot</groupId>--> |
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | <!-- CRM 相关模块。默认注释,保证编译速度 --> |
| 91 | 91 | <!-- <dependency>--> |
| 92 | 92 | <!-- <groupId>cn.iocoder.boot</groupId>--> |
| 93 | -<!-- <artifactId>yudao-module-crm-biz</artifactId>--> | |
| 93 | +<!-- <artifactId>yudao-module-crm</artifactId>--> | |
| 94 | 94 | <!-- <version>${revision}</version>--> |
| 95 | 95 | <!-- </dependency>--> |
| 96 | 96 | ... | ... |