Commit 23ef3c8ae00076fa711ab4daed8c96064b605f0c
1 parent
d7f04c94
📖 CRM:code review 跟进记录
Showing
15 changed files
with
27 additions
and
16 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| @@ -182,6 +182,7 @@ public class CrmCustomerController { | @@ -182,6 +182,7 @@ public class CrmCustomerController { | ||
| 182 | return success(true); | 182 | return success(true); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | + // TODO @puhui999:要不搞个通用的 CrmOperateLogController,之后所有业务都调用它? | ||
| 185 | @GetMapping("/operate-log-page") | 186 | @GetMapping("/operate-log-page") |
| 186 | @Operation(summary = "获得客户操作日志") | 187 | @Operation(summary = "获得客户操作日志") |
| 187 | @Parameter(name = "id", description = "客户编号", required = true) | 188 | @Parameter(name = "id", description = "客户编号", required = true) |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/permission/CrmPermissionController.java
| @@ -104,12 +104,8 @@ public class CrmPermissionController { | @@ -104,12 +104,8 @@ public class CrmPermissionController { | ||
| 104 | // 拼接数据 | 104 | // 拼接数据 |
| 105 | List<AdminUserRespDTO> userList = adminUserApi.getUserList(convertSet(permission, CrmPermissionDO::getUserId)); | 105 | List<AdminUserRespDTO> userList = adminUserApi.getUserList(convertSet(permission, CrmPermissionDO::getUserId)); |
| 106 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userList, AdminUserRespDTO::getDeptId)); | 106 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userList, AdminUserRespDTO::getDeptId)); |
| 107 | - Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds, item -> { | ||
| 108 | - if (item == null) { | ||
| 109 | - return Stream.empty(); | ||
| 110 | - } | ||
| 111 | - return item.stream(); | ||
| 112 | - }); | 107 | + Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds, |
| 108 | + item -> item != null ? item.stream() : Stream.empty()); | ||
| 113 | Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds); | 109 | Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds); |
| 114 | return success(CrmPermissionConvert.INSTANCE.convert(permission, userList, deptMap, postMap)); | 110 | return success(CrmPermissionConvert.INSTANCE.convert(permission, userList, deptMap, postMap)); |
| 115 | } | 111 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/permission/CrmPermissionConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.permission; | 1 | package cn.iocoder.yudao.module.crm.convert.permission; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionCreateReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionCreateReqVO; |
| @@ -48,12 +49,12 @@ public interface CrmPermissionConvert { | @@ -48,12 +49,12 @@ public interface CrmPermissionConvert { | ||
| 48 | findAndThen(userMap, item.getUserId(), user -> { | 49 | findAndThen(userMap, item.getUserId(), user -> { |
| 49 | item.setNickname(user.getNickname()); | 50 | item.setNickname(user.getNickname()); |
| 50 | findAndThen(deptMap, user.getDeptId(), deptRespDTO -> item.setDeptName(deptRespDTO.getName())); | 51 | findAndThen(deptMap, user.getDeptId(), deptRespDTO -> item.setDeptName(deptRespDTO.getName())); |
| 51 | - if (user.getPostIds() == null) { | 52 | + if (CollUtil.isEmpty(user.getPostIds())) { |
| 52 | item.setPostNames(Collections.emptySet()); | 53 | item.setPostNames(Collections.emptySet()); |
| 53 | return; | 54 | return; |
| 54 | } | 55 | } |
| 55 | - List<PostRespDTO> postRespList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds()); | ||
| 56 | - item.setPostNames(CollectionUtils.convertSet(postRespList, PostRespDTO::getName)); | 56 | + List<PostRespDTO> postList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds()); |
| 57 | + item.setPostNames(CollectionUtils.convertSet(postList, PostRespDTO::getName)); | ||
| 57 | }); | 58 | }); |
| 58 | return item; | 59 | return item; |
| 59 | }); | 60 | }); |
| @@ -64,6 +65,7 @@ public interface CrmPermissionConvert { | @@ -64,6 +65,7 @@ public interface CrmPermissionConvert { | ||
| 64 | id -> new CrmPermissionDO().setId(id).setLevel(updateReqVO.getLevel())); | 65 | id -> new CrmPermissionDO().setId(id).setLevel(updateReqVO.getLevel())); |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 68 | + // TODO @puhui999:搞成 BeanUtils | ||
| 67 | List<CrmPermissionDO> convertList(List<CrmPermissionCreateReqBO> list); | 69 | List<CrmPermissionDO> convertList(List<CrmPermissionCreateReqBO> list); |
| 68 | 70 | ||
| 69 | } | 71 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java
| @@ -72,7 +72,6 @@ public class CrmFollowUpRecordDO extends BaseDO { | @@ -72,7 +72,6 @@ public class CrmFollowUpRecordDO extends BaseDO { | ||
| 72 | */ | 72 | */ |
| 73 | @TableField(typeHandler = StringListTypeHandler.class) | 73 | @TableField(typeHandler = StringListTypeHandler.class) |
| 74 | private List<String> picUrls; | 74 | private List<String> picUrls; |
| 75 | - | ||
| 76 | /** | 75 | /** |
| 77 | * 附件 | 76 | * 附件 |
| 78 | */ | 77 | */ |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
| @@ -58,6 +58,7 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | @@ -58,6 +58,7 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { | ||
| 58 | MPJLambdaWrapperX<CrmBusinessDO> query = new MPJLambdaWrapperX<>(); | 58 | MPJLambdaWrapperX<CrmBusinessDO> query = new MPJLambdaWrapperX<>(); |
| 59 | // 拼接数据权限的查询条件 | 59 | // 拼接数据权限的查询条件 |
| 60 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_BUSINESS.getType(), ids, userId); | 60 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_BUSINESS.getType(), ids, userId); |
| 61 | + // 拼接自身的查询条件 | ||
| 61 | query.selectAll(CrmBusinessDO.class).in(CrmBusinessDO::getId, ids).orderByDesc(CrmBusinessDO::getId); | 62 | query.selectAll(CrmBusinessDO.class).in(CrmBusinessDO::getId, ids).orderByDesc(CrmBusinessDO::getId); |
| 62 | return selectJoinList(CrmBusinessDO.class, query); | 63 | return selectJoinList(CrmBusinessDO.class, query); |
| 63 | } | 64 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
| @@ -46,6 +46,7 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { | @@ -46,6 +46,7 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { | ||
| 46 | // 拼接数据权限的查询条件 | 46 | // 拼接数据权限的查询条件 |
| 47 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(), ids, userId); | 47 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(), ids, userId); |
| 48 | query.selectAll(CrmClueDO.class).in(CrmClueDO::getId, ids).orderByDesc(CrmClueDO::getId); | 48 | query.selectAll(CrmClueDO.class).in(CrmClueDO::getId, ids).orderByDesc(CrmClueDO::getId); |
| 49 | + // 拼接自身的查询条件 | ||
| 49 | return selectJoinList(CrmClueDO.class, query); | 50 | return selectJoinList(CrmClueDO.class, query); |
| 50 | } | 51 | } |
| 51 | 52 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
| @@ -67,6 +67,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> { | @@ -67,6 +67,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> { | ||
| 67 | MPJLambdaWrapperX<CrmContactDO> query = new MPJLambdaWrapperX<>(); | 67 | MPJLambdaWrapperX<CrmContactDO> query = new MPJLambdaWrapperX<>(); |
| 68 | // 拼接数据权限的查询条件 | 68 | // 拼接数据权限的查询条件 |
| 69 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId); | 69 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId); |
| 70 | + // 拼接自身的查询条件 | ||
| 70 | query.selectAll(CrmContactDO.class).in(CrmContactDO::getId, ids).orderByDesc(CrmContactDO::getId); | 71 | query.selectAll(CrmContactDO.class).in(CrmContactDO::getId, ids).orderByDesc(CrmContactDO::getId); |
| 71 | return selectJoinList(CrmContactDO.class, query); | 72 | return selectJoinList(CrmContactDO.class, query); |
| 72 | } | 73 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
| @@ -57,6 +57,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | @@ -57,6 +57,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | ||
| 57 | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); | 57 | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); |
| 58 | // 构建数据权限连表条件 | 58 | // 构建数据权限连表条件 |
| 59 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId); | 59 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId); |
| 60 | + // 拼接自身的查询条件 | ||
| 60 | query.selectAll(CrmContractDO.class).in(CrmContractDO::getId, ids).orderByDesc(CrmContractDO::getId); | 61 | query.selectAll(CrmContractDO.class).in(CrmContractDO::getId, ids).orderByDesc(CrmContractDO::getId); |
| 61 | return selectJoinList(CrmContractDO.class, query); | 62 | return selectJoinList(CrmContractDO.class, query); |
| 62 | } | 63 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
| @@ -64,6 +64,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { | @@ -64,6 +64,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { | ||
| 64 | MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); | 64 | MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>(); |
| 65 | // 拼接数据权限的查询条件 | 65 | // 拼接数据权限的查询条件 |
| 66 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, userId); | 66 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, userId); |
| 67 | + // 拼接自身的查询条件 | ||
| 67 | query.selectAll(CrmCustomerDO.class).in(CrmCustomerDO::getId, ids).orderByDesc(CrmCustomerDO::getId); | 68 | query.selectAll(CrmCustomerDO.class).in(CrmCustomerDO::getId, ids).orderByDesc(CrmCustomerDO::getId); |
| 68 | return selectJoinList(CrmCustomerDO.class, query); | 69 | return selectJoinList(CrmCustomerDO.class, query); |
| 69 | } | 70 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/permission/CrmPermissionMapper.java
| @@ -49,13 +49,13 @@ public interface CrmPermissionMapper extends BaseMapperX<CrmPermissionDO> { | @@ -49,13 +49,13 @@ public interface CrmPermissionMapper extends BaseMapperX<CrmPermissionDO> { | ||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | default CrmPermissionDO selectByIdAndUserId(Long id, Long userId) { | 51 | default CrmPermissionDO selectByIdAndUserId(Long id, Long userId) { |
| 52 | - return selectOne(new LambdaQueryWrapperX<CrmPermissionDO>() | ||
| 53 | - .eq(CrmPermissionDO::getId, id).eq(CrmPermissionDO::getUserId, userId)); | 52 | + return selectOne(CrmPermissionDO::getId, id, |
| 53 | + CrmPermissionDO::getUserId, userId); | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | - default CrmPermissionDO selectByBizIdAndUserId(Long id, Long userId) { | ||
| 57 | - return selectOne(new LambdaQueryWrapperX<CrmPermissionDO>() | ||
| 58 | - .eq(CrmPermissionDO::getBizId, id).eq(CrmPermissionDO::getUserId, userId)); | 56 | + default CrmPermissionDO selectByBizIdAndUserId(Long bizId, Long userId) { |
| 57 | + return selectOne(CrmPermissionDO::getBizId, bizId, | ||
| 58 | + CrmPermissionDO::getUserId, userId); | ||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | default int deletePermission(Integer bizType, Long bizId) { | 61 | default int deletePermission(Integer bizType, Long bizId) { |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java
| @@ -53,6 +53,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> { | @@ -53,6 +53,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> { | ||
| 53 | MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>(); | 53 | MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>(); |
| 54 | // 拼接数据权限的查询条件 | 54 | // 拼接数据权限的查询条件 |
| 55 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), ids, userId); | 55 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), ids, userId); |
| 56 | + // 拼接自身的查询条件 | ||
| 56 | query.selectAll(CrmReceivableDO.class).in(CrmReceivableDO::getId, ids).orderByDesc(CrmReceivableDO::getId); | 57 | query.selectAll(CrmReceivableDO.class).in(CrmReceivableDO::getId, ids).orderByDesc(CrmReceivableDO::getId); |
| 57 | return selectJoinList(CrmReceivableDO.class, query); | 58 | return selectJoinList(CrmReceivableDO.class, query); |
| 58 | } | 59 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
| @@ -52,6 +52,7 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | @@ -52,6 +52,7 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | ||
| 52 | MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); | 52 | MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); |
| 53 | // 拼接数据权限的查询条件 | 53 | // 拼接数据权限的查询条件 |
| 54 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), ids, userId); | 54 | CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), ids, userId); |
| 55 | + // 拼接自身的查询条件 | ||
| 55 | query.selectAll(CrmReceivablePlanDO.class).in(CrmReceivablePlanDO::getId, ids).orderByDesc(CrmReceivablePlanDO::getId); | 56 | query.selectAll(CrmReceivablePlanDO.class).in(CrmReceivablePlanDO::getId, ids).orderByDesc(CrmReceivablePlanDO::getId); |
| 56 | return selectJoinList(CrmReceivablePlanDO.class, query); | 57 | return selectJoinList(CrmReceivablePlanDO.class, query); |
| 57 | } | 58 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
| @@ -126,7 +126,6 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | @@ -126,7 +126,6 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | ||
| 126 | return crmFollowUpRecordMapper.selectById(id); | 126 | return crmFollowUpRecordMapper.selectById(id); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | - | ||
| 130 | @Override | 129 | @Override |
| 131 | @CrmPermission(bizTypeValue = "#pageReqVO.bizType", bizId = "#pageReqVO.bizId", level = CrmPermissionLevelEnum.READ) | 130 | @CrmPermission(bizTypeValue = "#pageReqVO.bizType", bizId = "#pageReqVO.bizId", level = CrmPermissionLevelEnum.READ) |
| 132 | public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) { | 131 | public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) { |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/coupon/CouponDO.java
| @@ -48,8 +48,11 @@ public class CouponDO extends BaseDO { | @@ -48,8 +48,11 @@ public class CouponDO extends BaseDO { | ||
| 48 | * | 48 | * |
| 49 | * 枚举 {@link CouponStatusEnum} | 49 | * 枚举 {@link CouponStatusEnum} |
| 50 | */ | 50 | */ |
| 51 | + // TODO 芋艿:已作废? | ||
| 51 | private Integer status; | 52 | private Integer status; |
| 52 | 53 | ||
| 54 | + // TODO 芋艿:发放 adminid? | ||
| 55 | + | ||
| 53 | // ========== 基本信息 END ========== | 56 | // ========== 基本信息 END ========== |
| 54 | 57 | ||
| 55 | // ========== 领取情况 BEGIN ========== | 58 | // ========== 领取情况 BEGIN ========== |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/coupon/CouponTemplateDO.java
| @@ -45,6 +45,7 @@ public class CouponTemplateDO extends BaseDO { | @@ -45,6 +45,7 @@ public class CouponTemplateDO extends BaseDO { | ||
| 45 | * | 45 | * |
| 46 | * 枚举 {@link CommonStatusEnum} | 46 | * 枚举 {@link CommonStatusEnum} |
| 47 | */ | 47 | */ |
| 48 | + // TODO 芋艿:要不要改成 3 个状态?? | ||
| 48 | private Integer status; | 49 | private Integer status; |
| 49 | 50 | ||
| 50 | // ========== 基本信息 END ========== | 51 | // ========== 基本信息 END ========== |
| @@ -159,4 +160,7 @@ public class CouponTemplateDO extends BaseDO { | @@ -159,4 +160,7 @@ public class CouponTemplateDO extends BaseDO { | ||
| 159 | private Integer useCount; | 160 | private Integer useCount; |
| 160 | // ========== 统计信息 END ========== | 161 | // ========== 统计信息 END ========== |
| 161 | 162 | ||
| 163 | + // TODO 芋艿:领取开始时间、领取结束时间 | ||
| 164 | + | ||
| 165 | + // TODO 芋艿:要不要加描述 | ||
| 162 | } | 166 | } |