From e79c750b469fa940f44146dec1964688cd79ef62 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 13 Jan 2024 09:56:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20CRM=EF=BC=9Acode=20review=20?= =?UTF-8?q?=E8=B7=9F=E8=BF=9B=E8=AE=B0=E5=BD=95=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/util/date/LocalDateTimeUtils.java | 2 +- yudao-module-crm/yudao-module-crm-api/pom.xml | 1 + .../CrmParseFunctionNameConstants.java | 3 +- .../admin/customer/CrmCustomerController.java | 24 ++++++------ .../CrmCustomerPoolConfigController.java | 4 +- .../plan/CrmReceivablePlanTransferReqVO.java | 25 ------------ .../CrmReceivableTransferReqVO.java | 25 ------------ .../convert/customer/CrmCustomerConvert.java | 37 +++++++++--------- .../CrmCustomerLimitConfigConvert.java | 38 +++++++------------ .../receivable/CrmReceivableConvert.java | 6 --- .../receivable/CrmReceivablePlanConvert.java | 6 --- .../crm/service/clue/CrmClueServiceImpl.java | 2 + .../contact/CrmContactServiceImpl.java | 1 - .../CrmCustomerLimitConfigServiceImpl.java | 14 +++---- .../customer/CrmCustomerServiceImpl.java | 16 ++++---- .../receivable/CrmReceivableServiceImpl.java | 3 +- .../SysParseFunctionNameConstants.java | 1 + 17 files changed, 68 insertions(+), 140 deletions(-) delete mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java delete mode 100644 yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java index 711797cd2..59656cbdd 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java @@ -123,7 +123,7 @@ public class LocalDateTimeUtils { } /** - * 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负。 + * 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负 * * @param dateTime 日期 * @return 相差天数 diff --git a/yudao-module-crm/yudao-module-crm-api/pom.xml b/yudao-module-crm/yudao-module-crm-api/pom.xml index 86d28a6aa..833ff5872 100644 --- a/yudao-module-crm/yudao-module-crm-api/pom.xml +++ b/yudao-module-crm/yudao-module-crm-api/pom.xml @@ -28,6 +28,7 @@ spring-boot-starter-validation true + cn.iocoder.boot yudao-module-system-api diff --git a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/operatelog/CrmParseFunctionNameConstants.java b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/operatelog/CrmParseFunctionNameConstants.java index 7aa8e05fd..d18fa3b8a 100644 --- a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/operatelog/CrmParseFunctionNameConstants.java +++ b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/operatelog/CrmParseFunctionNameConstants.java @@ -6,6 +6,7 @@ package cn.iocoder.yudao.module.crm.enums.operatelog; * * @author HUIHUI */ +// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈 public interface CrmParseFunctionNameConstants { String GET_CONTACT_BY_ID = "getContactById"; // 获取联系人信息 @@ -15,4 +16,4 @@ public interface CrmParseFunctionNameConstants { String GET_CUSTOMER_SOURCE = "getCustomerSource"; // 获取客户来源 String GET_CONTRACT_BY_ID = "getContractById"; // 获取合同信息 -} +} \ No newline at end of file diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java index 33b04b8aa..0ea42cad6 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java @@ -115,10 +115,8 @@ public class CrmCustomerController { } // 2. 拼接数据 - Map poolDayMap = null; - if (ObjUtil.notEqual(pageVO.getPool(), Boolean.TRUE)) { - poolDayMap = getPoolDayMap(pageResult.getList()); // 距离进入公海的时间 - } + Map poolDayMap = Boolean.TRUE.equals(pageVO.getPool()) ? null : + getPoolDayMap(pageResult.getList()); // 客户界面,需要查看距离进入公海的时间 Map userMap = adminUserApi.getUserMap( convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId()))); Map deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); @@ -132,21 +130,23 @@ public class CrmCustomerController { * @return Map */ private Map getPoolDayMap(List customerList) { - CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig(); - if (customerPoolConfig == null || !customerPoolConfig.getEnabled()) { + CrmCustomerPoolConfigDO poolConfig = customerPoolConfigService.getCustomerPoolConfig(); + if (poolConfig == null || !poolConfig.getEnabled()) { return MapUtil.empty(); } - // TODO @puhui999:需要考虑 lock 的情况么? 回复:锁定正常显示距离进入公海的时间有个提示 return convertMap(customerList, CrmCustomerDO::getId, customer -> { + // 1.1 未成交放入公海天数 long dealExpireDay = 0; - if (!customer.getDealStatus()) { // 检查是否成交 - dealExpireDay = customerPoolConfig.getDealExpireDays() - LocalDateTimeUtils.between(customer.getCreateTime()); + if (!customer.getDealStatus()) { + dealExpireDay = poolConfig.getDealExpireDays() - LocalDateTimeUtils.between(customer.getCreateTime()); } - LocalDateTime lastTime = customer.getContactLastTime() != null ? customer.getContactLastTime() : customer.getCreateTime(); - long contactExpireDay = customerPoolConfig.getContactExpireDays() - LocalDateTimeUtils.between(lastTime); + // 1.2 未跟进放入公海天数 + LocalDateTime lastTime = ObjUtil.defaultIfNull(customer.getContactLastTime(), customer.getCreateTime()); + long contactExpireDay = poolConfig.getContactExpireDays() - LocalDateTimeUtils.between(lastTime); if (contactExpireDay < 0) { - contactExpireDay = 0; // 如果为负的话重置为零 + contactExpireDay = 0; } + // 2. 返回最小的天数 return Math.min(dealExpireDay, contactExpireDay); }); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java index 94e5347fd..ca3b1ac62 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java @@ -29,8 +29,8 @@ public class CrmCustomerPoolConfigController { @Operation(summary = "获取客户公海规则设置") @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:query')") public CommonResult getCustomerPoolConfig() { - CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig(); - return success(BeanUtils.toBean(customerPoolConfig, CrmCustomerPoolConfigRespVO.class)); + CrmCustomerPoolConfigDO poolConfig = customerPoolConfigService.getCustomerPoolConfig(); + return success(BeanUtils.toBean(poolConfig, CrmCustomerPoolConfigRespVO.class)); } @PutMapping("/save") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java deleted file mode 100644 index 93f5413af..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; - -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; -import lombok.Data; - -@Schema(description = "管理后台 - CRM 回款计划转移 Request VO") -@Data -public class CrmReceivablePlanTransferReqVO { - - @Schema(description = "回款计划编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "回款计划编号不能为空") - private Long id; - - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "新负责人的用户编号不能为空") - private Long newOwnerUserId; - - @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @InEnum(value = CrmPermissionLevelEnum.class) - private Integer oldOwnerPermissionLevel; // 老负责人加入团队后的权限级别。如果 null 说明移除 - -} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java deleted file mode 100644 index 364ce4f8b..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; - -import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotNull; -import lombok.Data; - -@Schema(description = "管理后台 - CRM 回款转移 Request VO") -@Data -public class CrmReceivableTransferReqVO { - - @Schema(description = "回款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "回款编号不能为空") - private Long id; - - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") - @NotNull(message = "新负责人的用户编号不能为空") - private Long newOwnerUserId; - - @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @InEnum(value = CrmPermissionLevelEnum.class) - private Integer oldOwnerPermissionLevel; // 老负责人加入团队后的权限级别。如果 null 说明移除 - -} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java index 939ec452a..6a6642968 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.crm.convert.customer; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; @@ -26,7 +27,22 @@ public interface CrmCustomerConvert { CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); - CrmCustomerRespVO convert(CrmCustomerDO bean); + default CrmCustomerRespVO convert(CrmCustomerDO customer, Map userMap, + Map deptMap) { + CrmCustomerRespVO customerResp = BeanUtils.toBean(customer, CrmCustomerRespVO.class); + setUserInfo(customerResp, userMap, deptMap); + return customerResp; + } + + default PageResult convertPage(PageResult pageResult, Map userMap, + Map deptMap, Map poolDayMap) { + PageResult result = BeanUtils.toBean(pageResult, CrmCustomerRespVO.class); + result.getList().forEach(item -> { + setUserInfo(item, userMap, deptMap); + findAndThen(poolDayMap, item.getId(), item::setPoolDay); + }); + return result; + } /** * 设置用户信息 @@ -47,23 +63,4 @@ public interface CrmCustomerConvert { @Mapping(target = "bizId", source = "reqVO.id") CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); - PageResult convertPage(PageResult page); - - default CrmCustomerRespVO convert(CrmCustomerDO customer, Map userMap, - Map deptMap) { - CrmCustomerRespVO customerResp = convert(customer); - setUserInfo(customerResp, userMap, deptMap); - return customerResp; - } - - default PageResult convertPage(PageResult pageResult, Map userMap, - Map deptMap, Map poolDayMap) { - PageResult result = convertPage(pageResult); - result.getList().forEach(item -> { - setUserInfo(item, userMap, deptMap); - findAndThen(poolDayMap, item.getId(), item::setPoolDay); - }); - return result; - } - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerLimitConfigConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerLimitConfigConvert.java index 3566363af..81550b378 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerLimitConfigConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerLimitConfigConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.convert.customer; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigRespVO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.List; import java.util.Map; /** @@ -21,34 +23,20 @@ public interface CrmCustomerLimitConfigConvert { CrmCustomerLimitConfigConvert INSTANCE = Mappers.getMapper(CrmCustomerLimitConfigConvert.class); - CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO bean); - - PageResult convertPage(PageResult page); - - default PageResult convertPage(PageResult pageResult, - Map userMap, Map deptMap) { - PageResult result = convertPage(pageResult); - result.getList().forEach(respVo -> fillNameField(userMap, deptMap, respVo)); - return result; + default PageResult convertPage( + PageResult pageResult, + Map userMap, Map deptMap) { + List list = CollectionUtils.convertList(pageResult.getList(), + limitConfig -> convert(limitConfig, userMap, deptMap)); + return new PageResult<>(list, pageResult.getTotal()); } - default CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO customerLimitConfig, + default CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO limitConfig, Map userMap, Map deptMap) { - CrmCustomerLimitConfigRespVO respVo = convert(customerLimitConfig); - fillNameField(userMap, deptMap, respVo); - return respVo; - } - - /** - * 填充名称字段 - * - * @param userMap 用户映射 - * @param deptMap 部门映射 - * @param respVo 响应实体 - */ - static void fillNameField(Map userMap, Map deptMap, CrmCustomerLimitConfigRespVO respVo) { - respVo.setUsers(CollectionUtils.convertList(respVo.getUserIds(), userMap::get)); - respVo.setDepts(CollectionUtils.convertList(respVo.getDeptIds(), deptMap::get)); + CrmCustomerLimitConfigRespVO limitConfigVO = BeanUtils.toBean(limitConfig, CrmCustomerLimitConfigRespVO.class); + limitConfigVO.setUsers(CollectionUtils.convertList(limitConfigVO.getUserIds(), userMap::get)); + limitConfigVO.setDepts(CollectionUtils.convertList(limitConfigVO.getDeptIds(), deptMap::get)); + return limitConfigVO; } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java index 9f343238a..3b0c23aae 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivableConvert.java @@ -4,15 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableTransferReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import org.mapstruct.Mapper; -import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.List; @@ -52,7 +49,4 @@ public interface CrmReceivableConvert { return voPageResult; } - @Mapping(target = "bizId", source = "reqVO.id") - CrmPermissionTransferReqBO convert(CrmReceivableTransferReqVO reqVO, Long userId); - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java index eb459e071..9b6bb3e82 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/receivable/CrmReceivablePlanConvert.java @@ -4,16 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanTransferReqVO; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import org.mapstruct.Mapper; -import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.List; @@ -56,7 +53,4 @@ public interface CrmReceivablePlanConvert { return voPageResult; } - @Mapping(target = "bizId", source = "reqVO.id") - CrmPermissionTransferReqBO convert(CrmReceivablePlanTransferReqVO reqVO, Long userId); - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java index 9874f278c..8018f42f3 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java @@ -142,9 +142,11 @@ public class CrmClueServiceImpl implements CrmClueService { clues.forEach(clue -> { clue.setId(null); // 创建客户 + // TODO @puhui999:上面的 id 置空,适合 bean copy 后,在设置为 null,不直接修改 clu 哈 customerService.createCustomer(BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class), userId); // 更新线索状态 // TODO @min:新建一个 CrmClueDO 去更新。尽量规避直接用原本的对象去更新。因为这样万一并发更新,会存在覆盖的问题。 + // TODO @min:customerId 没有更新进去 // TODO @puhui999:如果有跟进记录,需要一起转过去; clue.setTransformStatus(Boolean.TRUE); clueMapper.updateById(clue); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java index 1597fa131..5bab0aa28 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java @@ -154,7 +154,6 @@ public class CrmContactServiceImpl implements CrmContactService { permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id); // 4.2 删除商机关联 contactBusinessService.deleteContactBusinessByContactId(id); - // TODO @puhui999:删除跟进记录 // 记录操作日志上下文 LogRecordContext.putVariable("contactName", contact.getName()); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java index d232f307d..6d6a49f46 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java @@ -48,13 +48,13 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig public Long createCustomerLimitConfig(CrmCustomerLimitConfigSaveReqVO createReqVO) { validateUserAndDept(createReqVO.getUserIds(), createReqVO.getDeptIds()); // 插入 - CrmCustomerLimitConfigDO customerLimitConfig = BeanUtils.toBean(createReqVO, CrmCustomerLimitConfigDO.class); - customerLimitConfigMapper.insert(customerLimitConfig); + CrmCustomerLimitConfigDO limitConfig = BeanUtils.toBean(createReqVO, CrmCustomerLimitConfigDO.class); + customerLimitConfigMapper.insert(limitConfig); // 记录操作日志上下文 - LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(customerLimitConfig.getType())); - LogRecordContext.putVariable("limitId", customerLimitConfig.getId()); - return customerLimitConfig.getId(); + LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfig.getType())); + LogRecordContext.putVariable("limitId", limitConfig.getId()); + return limitConfig.getId(); } @Override @@ -77,12 +77,12 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig success = CRM_CUSTOMER_LIMIT_CONFIG_DELETE_SUCCESS) public void deleteCustomerLimitConfig(Long id) { // 校验存在 - CrmCustomerLimitConfigDO limitConfigDO = validateCustomerLimitConfigExists(id); + CrmCustomerLimitConfigDO limitConfig = validateCustomerLimitConfigExists(id); // 删除 customerLimitConfigMapper.deleteById(id); // 记录操作日志上下文 - LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfigDO.getType())); + LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfig.getType())); } @Override diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index 4b0e550cc..fcb174a83 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -127,17 +127,17 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { success = CRM_CUSTOMER_DELETE_SUCCESS) @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) public void deleteCustomer(Long id) { - // 校验存在 + // 1.1 校验存在 CrmCustomerDO customer = validateCustomerExists(id); - // 检查引用 + // 1.2 检查引用 checkCustomerReference(id); - // 删除 - customerMapper.deleteById(id); - // 删除数据权限 - permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), id); - // TODO @puhui999:删除跟进记录 - // 记录操作日志上下文 + // 2. 删除 + customerMapper.deleteById(id); + // 3. 删除数据权限 + permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), id); + + // 4. 记录操作日志上下文 LogRecordContext.putVariable("customerName", customer.getName()); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java index 860c984d3..54c4aa82a 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java @@ -77,7 +77,8 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_RECEIVABLE.getType()) .setBizId(receivable.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 // TODO @liuhongfeng:需要更新关联的 plan - // 记录操作日志上下文 + + // 4. 记录操作日志上下文 LogRecordContext.putVariable("receivable", receivable); return receivable.getId(); } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/operatelog/SysParseFunctionNameConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/operatelog/SysParseFunctionNameConstants.java index dafaa37f6..f61039314 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/operatelog/SysParseFunctionNameConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/operatelog/SysParseFunctionNameConstants.java @@ -6,6 +6,7 @@ package cn.iocoder.yudao.module.system.enums.operatelog; * * @author HUIHUI */ +// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈 public interface SysParseFunctionNameConstants { String GET_ADMIN_USER_BY_ID = "getAdminUserById"; // 获取用户信息