Commit e79c750b469fa940f44146dec1964688cd79ef62
1 parent
d80406ac
📖 CRM:code review 跟进记录的实现
Showing
17 changed files
with
66 additions
and
138 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| @@ -123,7 +123,7 @@ public class LocalDateTimeUtils { | @@ -123,7 +123,7 @@ public class LocalDateTimeUtils { | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /** | 125 | /** |
| 126 | - * 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负。 | 126 | + * 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负 |
| 127 | * | 127 | * |
| 128 | * @param dateTime 日期 | 128 | * @param dateTime 日期 |
| 129 | * @return 相差天数 | 129 | * @return 相差天数 |
yudao-module-crm/yudao-module-crm-api/pom.xml
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | <artifactId>spring-boot-starter-validation</artifactId> | 28 | <artifactId>spring-boot-starter-validation</artifactId> |
| 29 | <optional>true</optional> | 29 | <optional>true</optional> |
| 30 | </dependency> | 30 | </dependency> |
| 31 | + <!-- TODO @puhui999:api 之间,不直接引入哈;然后,logrecord function 在微服务下,这么跑会高不起来,所以每个服务自己写 function --> | ||
| 31 | <dependency> | 32 | <dependency> |
| 32 | <groupId>cn.iocoder.boot</groupId> | 33 | <groupId>cn.iocoder.boot</groupId> |
| 33 | <artifactId>yudao-module-system-api</artifactId> | 34 | <artifactId>yudao-module-system-api</artifactId> |
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; | @@ -6,6 +6,7 @@ package cn.iocoder.yudao.module.crm.enums.operatelog; | ||
| 6 | * | 6 | * |
| 7 | * @author HUIHUI | 7 | * @author HUIHUI |
| 8 | */ | 8 | */ |
| 9 | +// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈 | ||
| 9 | public interface CrmParseFunctionNameConstants { | 10 | public interface CrmParseFunctionNameConstants { |
| 10 | 11 | ||
| 11 | String GET_CONTACT_BY_ID = "getContactById"; // 获取联系人信息 | 12 | String GET_CONTACT_BY_ID = "getContactById"; // 获取联系人信息 |
| @@ -15,4 +16,4 @@ public interface CrmParseFunctionNameConstants { | @@ -15,4 +16,4 @@ public interface CrmParseFunctionNameConstants { | ||
| 15 | String GET_CUSTOMER_SOURCE = "getCustomerSource"; // 获取客户来源 | 16 | String GET_CUSTOMER_SOURCE = "getCustomerSource"; // 获取客户来源 |
| 16 | String GET_CONTRACT_BY_ID = "getContractById"; // 获取合同信息 | 17 | String GET_CONTRACT_BY_ID = "getContractById"; // 获取合同信息 |
| 17 | 18 | ||
| 18 | -} | 19 | -} |
| 20 | +} | ||
| 19 | \ No newline at end of file | 21 | \ No newline at end of file |
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 { | @@ -115,10 +115,8 @@ public class CrmCustomerController { | ||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | // 2. 拼接数据 | 117 | // 2. 拼接数据 |
| 118 | - Map<Long, Long> poolDayMap = null; | ||
| 119 | - if (ObjUtil.notEqual(pageVO.getPool(), Boolean.TRUE)) { | ||
| 120 | - poolDayMap = getPoolDayMap(pageResult.getList()); // 距离进入公海的时间 | ||
| 121 | - } | 118 | + Map<Long, Long> poolDayMap = Boolean.TRUE.equals(pageVO.getPool()) ? null : |
| 119 | + getPoolDayMap(pageResult.getList()); // 客户界面,需要查看距离进入公海的时间 | ||
| 122 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | 120 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| 123 | convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId()))); | 121 | convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId()))); |
| 124 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); | 122 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| @@ -132,21 +130,23 @@ public class CrmCustomerController { | @@ -132,21 +130,23 @@ public class CrmCustomerController { | ||
| 132 | * @return Map<key 客户编号, value 距离进入公海的时间> | 130 | * @return Map<key 客户编号, value 距离进入公海的时间> |
| 133 | */ | 131 | */ |
| 134 | private Map<Long, Long> getPoolDayMap(List<CrmCustomerDO> customerList) { | 132 | private Map<Long, Long> getPoolDayMap(List<CrmCustomerDO> customerList) { |
| 135 | - CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig(); | ||
| 136 | - if (customerPoolConfig == null || !customerPoolConfig.getEnabled()) { | 133 | + CrmCustomerPoolConfigDO poolConfig = customerPoolConfigService.getCustomerPoolConfig(); |
| 134 | + if (poolConfig == null || !poolConfig.getEnabled()) { | ||
| 137 | return MapUtil.empty(); | 135 | return MapUtil.empty(); |
| 138 | } | 136 | } |
| 139 | - // TODO @puhui999:需要考虑 lock 的情况么? 回复:锁定正常显示距离进入公海的时间有个提示 | ||
| 140 | return convertMap(customerList, CrmCustomerDO::getId, customer -> { | 137 | return convertMap(customerList, CrmCustomerDO::getId, customer -> { |
| 138 | + // 1.1 未成交放入公海天数 | ||
| 141 | long dealExpireDay = 0; | 139 | long dealExpireDay = 0; |
| 142 | - if (!customer.getDealStatus()) { // 检查是否成交 | ||
| 143 | - dealExpireDay = customerPoolConfig.getDealExpireDays() - LocalDateTimeUtils.between(customer.getCreateTime()); | 140 | + if (!customer.getDealStatus()) { |
| 141 | + dealExpireDay = poolConfig.getDealExpireDays() - LocalDateTimeUtils.between(customer.getCreateTime()); | ||
| 144 | } | 142 | } |
| 145 | - LocalDateTime lastTime = customer.getContactLastTime() != null ? customer.getContactLastTime() : customer.getCreateTime(); | ||
| 146 | - long contactExpireDay = customerPoolConfig.getContactExpireDays() - LocalDateTimeUtils.between(lastTime); | 143 | + // 1.2 未跟进放入公海天数 |
| 144 | + LocalDateTime lastTime = ObjUtil.defaultIfNull(customer.getContactLastTime(), customer.getCreateTime()); | ||
| 145 | + long contactExpireDay = poolConfig.getContactExpireDays() - LocalDateTimeUtils.between(lastTime); | ||
| 147 | if (contactExpireDay < 0) { | 146 | if (contactExpireDay < 0) { |
| 148 | - contactExpireDay = 0; // 如果为负的话重置为零 | 147 | + contactExpireDay = 0; |
| 149 | } | 148 | } |
| 149 | + // 2. 返回最小的天数 | ||
| 150 | return Math.min(dealExpireDay, contactExpireDay); | 150 | return Math.min(dealExpireDay, contactExpireDay); |
| 151 | }); | 151 | }); |
| 152 | } | 152 | } |
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 { | @@ -29,8 +29,8 @@ public class CrmCustomerPoolConfigController { | ||
| 29 | @Operation(summary = "获取客户公海规则设置") | 29 | @Operation(summary = "获取客户公海规则设置") |
| 30 | @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:query')") | 30 | @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:query')") |
| 31 | public CommonResult<CrmCustomerPoolConfigRespVO> getCustomerPoolConfig() { | 31 | public CommonResult<CrmCustomerPoolConfigRespVO> getCustomerPoolConfig() { |
| 32 | - CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig(); | ||
| 33 | - return success(BeanUtils.toBean(customerPoolConfig, CrmCustomerPoolConfigRespVO.class)); | 32 | + CrmCustomerPoolConfigDO poolConfig = customerPoolConfigService.getCustomerPoolConfig(); |
| 33 | + return success(BeanUtils.toBean(poolConfig, CrmCustomerPoolConfigRespVO.class)); | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | @PutMapping("/save") | 36 | @PutMapping("/save") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanTransferReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | ||
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | -import jakarta.validation.constraints.NotNull; | ||
| 7 | -import lombok.Data; | ||
| 8 | - | ||
| 9 | -@Schema(description = "管理后台 - CRM 回款计划转移 Request VO") | ||
| 10 | -@Data | ||
| 11 | -public class CrmReceivablePlanTransferReqVO { | ||
| 12 | - | ||
| 13 | - @Schema(description = "回款计划编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 14 | - @NotNull(message = "回款计划编号不能为空") | ||
| 15 | - private Long id; | ||
| 16 | - | ||
| 17 | - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 18 | - @NotNull(message = "新负责人的用户编号不能为空") | ||
| 19 | - private Long newOwnerUserId; | ||
| 20 | - | ||
| 21 | - @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 22 | - @InEnum(value = CrmPermissionLevelEnum.class) | ||
| 23 | - private Integer oldOwnerPermissionLevel; // 老负责人加入团队后的权限级别。如果 null 说明移除 | ||
| 24 | - | ||
| 25 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableTransferReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | -import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | ||
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | -import jakarta.validation.constraints.NotNull; | ||
| 7 | -import lombok.Data; | ||
| 8 | - | ||
| 9 | -@Schema(description = "管理后台 - CRM 回款转移 Request VO") | ||
| 10 | -@Data | ||
| 11 | -public class CrmReceivableTransferReqVO { | ||
| 12 | - | ||
| 13 | - @Schema(description = "回款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 14 | - @NotNull(message = "回款编号不能为空") | ||
| 15 | - private Long id; | ||
| 16 | - | ||
| 17 | - @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 18 | - @NotNull(message = "新负责人的用户编号不能为空") | ||
| 19 | - private Long newOwnerUserId; | ||
| 20 | - | ||
| 21 | - @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 22 | - @InEnum(value = CrmPermissionLevelEnum.class) | ||
| 23 | - private Integer oldOwnerPermissionLevel; // 老负责人加入团队后的权限级别。如果 null 说明移除 | ||
| 24 | - | ||
| 25 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.customer; | 1 | package cn.iocoder.yudao.module.crm.convert.customer; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 5 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; |
| @@ -26,7 +27,22 @@ public interface CrmCustomerConvert { | @@ -26,7 +27,22 @@ public interface CrmCustomerConvert { | ||
| 26 | 27 | ||
| 27 | CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); | 28 | CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); |
| 28 | 29 | ||
| 29 | - CrmCustomerRespVO convert(CrmCustomerDO bean); | 30 | + default CrmCustomerRespVO convert(CrmCustomerDO customer, Map<Long, AdminUserRespDTO> userMap, |
| 31 | + Map<Long, DeptRespDTO> deptMap) { | ||
| 32 | + CrmCustomerRespVO customerResp = BeanUtils.toBean(customer, CrmCustomerRespVO.class); | ||
| 33 | + setUserInfo(customerResp, userMap, deptMap); | ||
| 34 | + return customerResp; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + default PageResult<CrmCustomerRespVO> convertPage(PageResult<CrmCustomerDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | ||
| 38 | + Map<Long, DeptRespDTO> deptMap, Map<Long, Long> poolDayMap) { | ||
| 39 | + PageResult<CrmCustomerRespVO> result = BeanUtils.toBean(pageResult, CrmCustomerRespVO.class); | ||
| 40 | + result.getList().forEach(item -> { | ||
| 41 | + setUserInfo(item, userMap, deptMap); | ||
| 42 | + findAndThen(poolDayMap, item.getId(), item::setPoolDay); | ||
| 43 | + }); | ||
| 44 | + return result; | ||
| 45 | + } | ||
| 30 | 46 | ||
| 31 | /** | 47 | /** |
| 32 | * 设置用户信息 | 48 | * 设置用户信息 |
| @@ -47,23 +63,4 @@ public interface CrmCustomerConvert { | @@ -47,23 +63,4 @@ public interface CrmCustomerConvert { | ||
| 47 | @Mapping(target = "bizId", source = "reqVO.id") | 63 | @Mapping(target = "bizId", source = "reqVO.id") |
| 48 | CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); | 64 | CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); |
| 49 | 65 | ||
| 50 | - PageResult<CrmCustomerRespVO> convertPage(PageResult<CrmCustomerDO> page); | ||
| 51 | - | ||
| 52 | - default CrmCustomerRespVO convert(CrmCustomerDO customer, Map<Long, AdminUserRespDTO> userMap, | ||
| 53 | - Map<Long, DeptRespDTO> deptMap) { | ||
| 54 | - CrmCustomerRespVO customerResp = convert(customer); | ||
| 55 | - setUserInfo(customerResp, userMap, deptMap); | ||
| 56 | - return customerResp; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - default PageResult<CrmCustomerRespVO> convertPage(PageResult<CrmCustomerDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | ||
| 60 | - Map<Long, DeptRespDTO> deptMap, Map<Long, Long> poolDayMap) { | ||
| 61 | - PageResult<CrmCustomerRespVO> result = convertPage(pageResult); | ||
| 62 | - result.getList().forEach(item -> { | ||
| 63 | - setUserInfo(item, userMap, deptMap); | ||
| 64 | - findAndThen(poolDayMap, item.getId(), item::setPoolDay); | ||
| 65 | - }); | ||
| 66 | - return result; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | } | 66 | } |
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; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.convert.customer; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigRespVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.limitconfig.CrmCustomerLimitConfigRespVO; |
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; |
| 7 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 9 | import org.mapstruct.Mapper; | 10 | import org.mapstruct.Mapper; |
| 10 | import org.mapstruct.factory.Mappers; | 11 | import org.mapstruct.factory.Mappers; |
| 11 | 12 | ||
| 13 | +import java.util.List; | ||
| 12 | import java.util.Map; | 14 | import java.util.Map; |
| 13 | 15 | ||
| 14 | /** | 16 | /** |
| @@ -21,34 +23,20 @@ public interface CrmCustomerLimitConfigConvert { | @@ -21,34 +23,20 @@ public interface CrmCustomerLimitConfigConvert { | ||
| 21 | 23 | ||
| 22 | CrmCustomerLimitConfigConvert INSTANCE = Mappers.getMapper(CrmCustomerLimitConfigConvert.class); | 24 | CrmCustomerLimitConfigConvert INSTANCE = Mappers.getMapper(CrmCustomerLimitConfigConvert.class); |
| 23 | 25 | ||
| 24 | - CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO bean); | ||
| 25 | - | ||
| 26 | - PageResult<CrmCustomerLimitConfigRespVO> convertPage(PageResult<CrmCustomerLimitConfigDO> page); | ||
| 27 | - | ||
| 28 | - default PageResult<CrmCustomerLimitConfigRespVO> convertPage(PageResult<CrmCustomerLimitConfigDO> pageResult, | ||
| 29 | - Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap) { | ||
| 30 | - PageResult<CrmCustomerLimitConfigRespVO> result = convertPage(pageResult); | ||
| 31 | - result.getList().forEach(respVo -> fillNameField(userMap, deptMap, respVo)); | ||
| 32 | - return result; | 26 | + default PageResult<CrmCustomerLimitConfigRespVO> convertPage( |
| 27 | + PageResult<CrmCustomerLimitConfigDO> pageResult, | ||
| 28 | + Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap) { | ||
| 29 | + List<CrmCustomerLimitConfigRespVO> list = CollectionUtils.convertList(pageResult.getList(), | ||
| 30 | + limitConfig -> convert(limitConfig, userMap, deptMap)); | ||
| 31 | + return new PageResult<>(list, pageResult.getTotal()); | ||
| 33 | } | 32 | } |
| 34 | 33 | ||
| 35 | - default CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO customerLimitConfig, | 34 | + default CrmCustomerLimitConfigRespVO convert(CrmCustomerLimitConfigDO limitConfig, |
| 36 | Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap) { | 35 | Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap) { |
| 37 | - CrmCustomerLimitConfigRespVO respVo = convert(customerLimitConfig); | ||
| 38 | - fillNameField(userMap, deptMap, respVo); | ||
| 39 | - return respVo; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - /** | ||
| 43 | - * 填充名称字段 | ||
| 44 | - * | ||
| 45 | - * @param userMap 用户映射 | ||
| 46 | - * @param deptMap 部门映射 | ||
| 47 | - * @param respVo 响应实体 | ||
| 48 | - */ | ||
| 49 | - static void fillNameField(Map<Long, AdminUserRespDTO> userMap, Map<Long, DeptRespDTO> deptMap, CrmCustomerLimitConfigRespVO respVo) { | ||
| 50 | - respVo.setUsers(CollectionUtils.convertList(respVo.getUserIds(), userMap::get)); | ||
| 51 | - respVo.setDepts(CollectionUtils.convertList(respVo.getDeptIds(), deptMap::get)); | 36 | + CrmCustomerLimitConfigRespVO limitConfigVO = BeanUtils.toBean(limitConfig, CrmCustomerLimitConfigRespVO.class); |
| 37 | + limitConfigVO.setUsers(CollectionUtils.convertList(limitConfigVO.getUserIds(), userMap::get)); | ||
| 38 | + limitConfigVO.setDepts(CollectionUtils.convertList(limitConfigVO.getDeptIds(), deptMap::get)); | ||
| 39 | + return limitConfigVO; | ||
| 52 | } | 40 | } |
| 53 | 41 | ||
| 54 | } | 42 | } |
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; | @@ -4,15 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableRespVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableTransferReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableUpdateReqVO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| 12 | -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | ||
| 13 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 11 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 14 | import org.mapstruct.Mapper; | 12 | import org.mapstruct.Mapper; |
| 15 | -import org.mapstruct.Mapping; | ||
| 16 | import org.mapstruct.factory.Mappers; | 13 | import org.mapstruct.factory.Mappers; |
| 17 | 14 | ||
| 18 | import java.util.List; | 15 | import java.util.List; |
| @@ -52,7 +49,4 @@ public interface CrmReceivableConvert { | @@ -52,7 +49,4 @@ public interface CrmReceivableConvert { | ||
| 52 | return voPageResult; | 49 | return voPageResult; |
| 53 | } | 50 | } |
| 54 | 51 | ||
| 55 | - @Mapping(target = "bizId", source = "reqVO.id") | ||
| 56 | - CrmPermissionTransferReqBO convert(CrmReceivableTransferReqVO reqVO, Long userId); | ||
| 57 | - | ||
| 58 | } | 52 | } |
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; | @@ -4,16 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanRespVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanTransferReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanUpdateReqVO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO; |
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| 13 | -import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | ||
| 14 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 12 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 15 | import org.mapstruct.Mapper; | 13 | import org.mapstruct.Mapper; |
| 16 | -import org.mapstruct.Mapping; | ||
| 17 | import org.mapstruct.factory.Mappers; | 14 | import org.mapstruct.factory.Mappers; |
| 18 | 15 | ||
| 19 | import java.util.List; | 16 | import java.util.List; |
| @@ -56,7 +53,4 @@ public interface CrmReceivablePlanConvert { | @@ -56,7 +53,4 @@ public interface CrmReceivablePlanConvert { | ||
| 56 | return voPageResult; | 53 | return voPageResult; |
| 57 | } | 54 | } |
| 58 | 55 | ||
| 59 | - @Mapping(target = "bizId", source = "reqVO.id") | ||
| 60 | - CrmPermissionTransferReqBO convert(CrmReceivablePlanTransferReqVO reqVO, Long userId); | ||
| 61 | - | ||
| 62 | } | 56 | } |
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 { | @@ -142,9 +142,11 @@ public class CrmClueServiceImpl implements CrmClueService { | ||
| 142 | clues.forEach(clue -> { | 142 | clues.forEach(clue -> { |
| 143 | clue.setId(null); | 143 | clue.setId(null); |
| 144 | // 创建客户 | 144 | // 创建客户 |
| 145 | + // TODO @puhui999:上面的 id 置空,适合 bean copy 后,在设置为 null,不直接修改 clu 哈 | ||
| 145 | customerService.createCustomer(BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class), userId); | 146 | customerService.createCustomer(BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class), userId); |
| 146 | // 更新线索状态 | 147 | // 更新线索状态 |
| 147 | // TODO @min:新建一个 CrmClueDO 去更新。尽量规避直接用原本的对象去更新。因为这样万一并发更新,会存在覆盖的问题。 | 148 | // TODO @min:新建一个 CrmClueDO 去更新。尽量规避直接用原本的对象去更新。因为这样万一并发更新,会存在覆盖的问题。 |
| 149 | + // TODO @min:customerId 没有更新进去 | ||
| 148 | // TODO @puhui999:如果有跟进记录,需要一起转过去; | 150 | // TODO @puhui999:如果有跟进记录,需要一起转过去; |
| 149 | clue.setTransformStatus(Boolean.TRUE); | 151 | clue.setTransformStatus(Boolean.TRUE); |
| 150 | clueMapper.updateById(clue); | 152 | clueMapper.updateById(clue); |
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 { | @@ -154,7 +154,6 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 154 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id); | 154 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CONTACT.getType(), id); |
| 155 | // 4.2 删除商机关联 | 155 | // 4.2 删除商机关联 |
| 156 | contactBusinessService.deleteContactBusinessByContactId(id); | 156 | contactBusinessService.deleteContactBusinessByContactId(id); |
| 157 | - // TODO @puhui999:删除跟进记录 | ||
| 158 | 157 | ||
| 159 | // 记录操作日志上下文 | 158 | // 记录操作日志上下文 |
| 160 | LogRecordContext.putVariable("contactName", contact.getName()); | 159 | LogRecordContext.putVariable("contactName", contact.getName()); |
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 | @@ -48,13 +48,13 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig | ||
| 48 | public Long createCustomerLimitConfig(CrmCustomerLimitConfigSaveReqVO createReqVO) { | 48 | public Long createCustomerLimitConfig(CrmCustomerLimitConfigSaveReqVO createReqVO) { |
| 49 | validateUserAndDept(createReqVO.getUserIds(), createReqVO.getDeptIds()); | 49 | validateUserAndDept(createReqVO.getUserIds(), createReqVO.getDeptIds()); |
| 50 | // 插入 | 50 | // 插入 |
| 51 | - CrmCustomerLimitConfigDO customerLimitConfig = BeanUtils.toBean(createReqVO, CrmCustomerLimitConfigDO.class); | ||
| 52 | - customerLimitConfigMapper.insert(customerLimitConfig); | 51 | + CrmCustomerLimitConfigDO limitConfig = BeanUtils.toBean(createReqVO, CrmCustomerLimitConfigDO.class); |
| 52 | + customerLimitConfigMapper.insert(limitConfig); | ||
| 53 | 53 | ||
| 54 | // 记录操作日志上下文 | 54 | // 记录操作日志上下文 |
| 55 | - LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(customerLimitConfig.getType())); | ||
| 56 | - LogRecordContext.putVariable("limitId", customerLimitConfig.getId()); | ||
| 57 | - return customerLimitConfig.getId(); | 55 | + LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfig.getType())); |
| 56 | + LogRecordContext.putVariable("limitId", limitConfig.getId()); | ||
| 57 | + return limitConfig.getId(); | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| @@ -77,12 +77,12 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig | @@ -77,12 +77,12 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig | ||
| 77 | success = CRM_CUSTOMER_LIMIT_CONFIG_DELETE_SUCCESS) | 77 | success = CRM_CUSTOMER_LIMIT_CONFIG_DELETE_SUCCESS) |
| 78 | public void deleteCustomerLimitConfig(Long id) { | 78 | public void deleteCustomerLimitConfig(Long id) { |
| 79 | // 校验存在 | 79 | // 校验存在 |
| 80 | - CrmCustomerLimitConfigDO limitConfigDO = validateCustomerLimitConfigExists(id); | 80 | + CrmCustomerLimitConfigDO limitConfig = validateCustomerLimitConfigExists(id); |
| 81 | // 删除 | 81 | // 删除 |
| 82 | customerLimitConfigMapper.deleteById(id); | 82 | customerLimitConfigMapper.deleteById(id); |
| 83 | 83 | ||
| 84 | // 记录操作日志上下文 | 84 | // 记录操作日志上下文 |
| 85 | - LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfigDO.getType())); | 85 | + LogRecordContext.putVariable("limitType", CrmCustomerLimitConfigTypeEnum.getNameByType(limitConfig.getType())); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | @Override | 88 | @Override |
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 { | @@ -127,17 +127,17 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 127 | success = CRM_CUSTOMER_DELETE_SUCCESS) | 127 | success = CRM_CUSTOMER_DELETE_SUCCESS) |
| 128 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) | 128 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) |
| 129 | public void deleteCustomer(Long id) { | 129 | public void deleteCustomer(Long id) { |
| 130 | - // 校验存在 | 130 | + // 1.1 校验存在 |
| 131 | CrmCustomerDO customer = validateCustomerExists(id); | 131 | CrmCustomerDO customer = validateCustomerExists(id); |
| 132 | - // 检查引用 | 132 | + // 1.2 检查引用 |
| 133 | checkCustomerReference(id); | 133 | checkCustomerReference(id); |
| 134 | - // 删除 | 134 | + |
| 135 | + // 2. 删除 | ||
| 135 | customerMapper.deleteById(id); | 136 | customerMapper.deleteById(id); |
| 136 | - // 删除数据权限 | 137 | + // 3. 删除数据权限 |
| 137 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), id); | 138 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), id); |
| 138 | - // TODO @puhui999:删除跟进记录 | ||
| 139 | 139 | ||
| 140 | - // 记录操作日志上下文 | 140 | + // 4. 记录操作日志上下文 |
| 141 | LogRecordContext.putVariable("customerName", customer.getName()); | 141 | LogRecordContext.putVariable("customerName", customer.getName()); |
| 142 | } | 142 | } |
| 143 | 143 |
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 { | @@ -77,7 +77,8 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { | ||
| 77 | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_RECEIVABLE.getType()) | 77 | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_RECEIVABLE.getType()) |
| 78 | .setBizId(receivable.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 | 78 | .setBizId(receivable.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 |
| 79 | // TODO @liuhongfeng:需要更新关联的 plan | 79 | // TODO @liuhongfeng:需要更新关联的 plan |
| 80 | - // 记录操作日志上下文 | 80 | + |
| 81 | + // 4. 记录操作日志上下文 | ||
| 81 | LogRecordContext.putVariable("receivable", receivable); | 82 | LogRecordContext.putVariable("receivable", receivable); |
| 82 | return receivable.getId(); | 83 | return receivable.getId(); |
| 83 | } | 84 | } |
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; | @@ -6,6 +6,7 @@ package cn.iocoder.yudao.module.system.enums.operatelog; | ||
| 6 | * | 6 | * |
| 7 | * @author HUIHUI | 7 | * @author HUIHUI |
| 8 | */ | 8 | */ |
| 9 | +// TODO @puhui999:这个枚举,还是放在对应的 Function 里好。主要考虑,和 Function 实现可以更近一点哈 | ||
| 9 | public interface SysParseFunctionNameConstants { | 10 | public interface SysParseFunctionNameConstants { |
| 10 | 11 | ||
| 11 | String GET_ADMIN_USER_BY_ID = "getAdminUserById"; // 获取用户信息 | 12 | String GET_ADMIN_USER_BY_ID = "getAdminUserById"; // 获取用户信息 |