Commit 6b426fcd01523ab5eb8318cb0eef8f3beb05db40
1 parent
ad4044f9
CRM: 修复一下差异
Showing
5 changed files
with
59 additions
and
19 deletions
yudao-module-crm/yudao-module-crm-api/pom.xml
| ... | ... | @@ -28,6 +28,12 @@ |
| 28 | 28 | <artifactId>spring-boot-starter-validation</artifactId> |
| 29 | 29 | <optional>true</optional> |
| 30 | 30 | </dependency> |
| 31 | + <dependency> | |
| 32 | + <groupId>cn.iocoder.boot</groupId> | |
| 33 | + <artifactId>yudao-module-system-api</artifactId> | |
| 34 | + <version>${revision}</version> | |
| 35 | + <optional>true</optional> | |
| 36 | + </dependency> | |
| 31 | 37 | </dependencies> |
| 32 | 38 | |
| 33 | 39 | </project> | ... | ... |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.enums; |
| 2 | 2 | |
| 3 | 3 | import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID; |
| 4 | +import static cn.iocoder.yudao.module.system.enums.operatelog.SysParseFunctionNameConstants.GET_ADMIN_USER_BY_ID; | |
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * CRM 操作日志枚举 |
| ... | ... | @@ -24,7 +25,7 @@ public interface LogRecordConstants { |
| 24 | 25 | String CRM_CUSTOMER_DELETE_SUB_TYPE = "删除客户"; |
| 25 | 26 | String CRM_CUSTOMER_DELETE_SUCCESS = "删除了客户【{{#customerName}}】"; |
| 26 | 27 | String CRM_CUSTOMER_TRANSFER_SUB_TYPE = "转移客户"; |
| 27 | - String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{getAdminUserById{#customer.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】"; | |
| 28 | + String CRM_CUSTOMER_TRANSFER_SUCCESS = "将客户【{{#customer.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#customer.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】"; | |
| 28 | 29 | String CRM_CUSTOMER_LOCK_SUB_TYPE = "{{#customer.lockStatus ? '解锁客户' : '锁定客户'}}"; |
| 29 | 30 | String CRM_CUSTOMER_LOCK_SUCCESS = "{{#customer.lockStatus ? '将客户【' + #customer.name + '】解锁' : '将客户【' + #customer.name + '】锁定'}}"; |
| 30 | 31 | String CRM_CUSTOMER_POOL_SUB_TYPE = "客户放入公海"; |
| ... | ... | @@ -58,8 +59,7 @@ public interface LogRecordConstants { |
| 58 | 59 | String CRM_CONTACT_DELETE_SUB_TYPE = "删除联系人"; |
| 59 | 60 | String CRM_CONTACT_DELETE_SUCCESS = "删除了联系人【{{#contactName}}】"; |
| 60 | 61 | String CRM_CONTACT_TRANSFER_SUB_TYPE = "转移联系人"; |
| 61 | - String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{getAdminUserById{#contact.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】"; | |
| 62 | - | |
| 62 | + String CRM_CONTACT_TRANSFER_SUCCESS = "将联系人【{{#contact.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contact.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】"; | |
| 63 | 63 | |
| 64 | 64 | // ======================= CRM_BUSINESS 商机 ======================= |
| 65 | 65 | |
| ... | ... | @@ -71,7 +71,7 @@ public interface LogRecordConstants { |
| 71 | 71 | String CRM_BUSINESS_DELETE_SUB_TYPE = "删除商机"; |
| 72 | 72 | String CRM_BUSINESS_DELETE_SUCCESS = "删除了商机【{{#businessName}}】"; |
| 73 | 73 | String CRM_BUSINESS_TRANSFER_SUB_TYPE = "转移商机"; |
| 74 | - String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{getAdminUserById{#business.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】"; | |
| 74 | + String CRM_BUSINESS_TRANSFER_SUCCESS = "将商机【{{#business.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#business.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】"; | |
| 75 | 75 | |
| 76 | 76 | // ======================= CRM_CONTRACT 合同 ======================= |
| 77 | 77 | |
| ... | ... | @@ -83,8 +83,7 @@ public interface LogRecordConstants { |
| 83 | 83 | String CRM_CONTRACT_DELETE_SUB_TYPE = "删除合同"; |
| 84 | 84 | String CRM_CONTRACT_DELETE_SUCCESS = "删除了合同【{{#contractName}}】"; |
| 85 | 85 | String CRM_CONTRACT_TRANSFER_SUB_TYPE = "转移合同"; |
| 86 | - String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{getAdminUserById{#contract.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】"; | |
| 87 | - | |
| 86 | + String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{" + GET_ADMIN_USER_BY_ID + "{#contract.ownerUserId}}】变更为了【{" + GET_ADMIN_USER_BY_ID + "{#reqVO.newOwnerUserId}}】"; | |
| 88 | 87 | |
| 89 | 88 | // ======================= CRM_PRODUCT 产品 ======================= |
| 90 | 89 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| ... | ... | @@ -4,9 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 5 | 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO; |
| 6 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigRespVO; | |
| 8 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | |
| 9 | -import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; | |
| 10 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 11 | 8 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| 12 | 9 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| ... | ... | @@ -69,12 +66,4 @@ public interface CrmCustomerConvert { |
| 69 | 66 | return result; |
| 70 | 67 | } |
| 71 | 68 | |
| 72 | - CrmCustomerPoolConfigRespVO convert(CrmCustomerPoolConfigDO customerPoolConfig); | |
| 73 | - | |
| 74 | - CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigSaveReqVO updateReqVO); | |
| 75 | - | |
| 76 | - // TODO @min:使用 BeanUtils 拷贝哈。我们慢慢简单的对象,不再直接基于 convert 做啦。 | |
| 77 | - @Mapping(ignore = true, target = "id") | |
| 78 | - CrmCustomerSaveReqVO convert(CrmClueDO bean); | |
| 79 | - | |
| 80 | 69 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmContractParseFunction.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.framework.operatelog.core; | |
| 2 | + | |
| 3 | +import cn.hutool.core.util.StrUtil; | |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | |
| 6 | +import com.mzt.logapi.service.IParseFunction; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import lombok.extern.slf4j.Slf4j; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +import static cn.iocoder.yudao.module.crm.enums.operatelog.CrmParseFunctionNameConstants.GET_CONTRACT_BY_ID; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * CRM 合同的 {@link IParseFunction} 实现类 | |
| 15 | + * | |
| 16 | + * @author HUIHUI | |
| 17 | + */ | |
| 18 | +@Component | |
| 19 | +@Slf4j | |
| 20 | +public class CrmContractParseFunction implements IParseFunction { | |
| 21 | + | |
| 22 | + @Resource | |
| 23 | + private CrmContractService contractService; | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public boolean executeBefore() { | |
| 27 | + return true; // 先转换值后对比 | |
| 28 | + } | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public String functionName() { | |
| 32 | + return GET_CONTRACT_BY_ID; | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public String apply(Object value) { | |
| 37 | + if (StrUtil.isEmptyIfStr(value)) { | |
| 38 | + return ""; | |
| 39 | + } | |
| 40 | + CrmContractDO contract = contractService.getContract(Long.parseLong(value.toString())); | |
| 41 | + return contract == null ? "" : contract.getName(); | |
| 42 | + } | |
| 43 | + | |
| 44 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| ... | ... | @@ -3,12 +3,13 @@ package cn.iocoder.yudao.module.crm.service.clue; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; |
| 9 | 10 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransformReqVO; |
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; | |
| 10 | 12 | import cn.iocoder.yudao.module.crm.convert.clue.CrmClueConvert; |
| 11 | -import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | |
| 12 | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 13 | 14 | import cn.iocoder.yudao.module.crm.dal.mysql.clue.CrmClueMapper; |
| 14 | 15 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| ... | ... | @@ -139,8 +140,9 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 139 | 140 | |
| 140 | 141 | // 遍历线索,创建对应的客户 |
| 141 | 142 | clues.forEach(clue -> { |
| 143 | + clue.setId(null); | |
| 142 | 144 | // 创建客户 |
| 143 | - customerService.createCustomer(CrmCustomerConvert.INSTANCE.convert(clue), userId); | |
| 145 | + customerService.createCustomer(BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class), userId); | |
| 144 | 146 | // 更新线索状态 |
| 145 | 147 | // TODO @min:新建一个 CrmClueDO 去更新。尽量规避直接用原本的对象去更新。因为这样万一并发更新,会存在覆盖的问题。 |
| 146 | 148 | // TODO @puhui999:如果有跟进记录,需要一起转过去; | ... | ... |