📖 CRM:code review 跟进记录
This commit is contained in:
parent
d7f04c94bb
commit
23ef3c8ae0
|
@ -182,6 +182,7 @@ public class CrmCustomerController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999:要不搞个通用的 CrmOperateLogController,之后所有业务都调用它?
|
||||
@GetMapping("/operate-log-page")
|
||||
@Operation(summary = "获得客户操作日志")
|
||||
@Parameter(name = "id", description = "客户编号", required = true)
|
||||
|
|
|
@ -104,12 +104,8 @@ public class CrmPermissionController {
|
|||
// 拼接数据
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(convertSet(permission, CrmPermissionDO::getUserId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userList, AdminUserRespDTO::getDeptId));
|
||||
Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds, item -> {
|
||||
if (item == null) {
|
||||
return Stream.empty();
|
||||
}
|
||||
return item.stream();
|
||||
});
|
||||
Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds,
|
||||
item -> item != null ? item.stream() : Stream.empty());
|
||||
Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds);
|
||||
return success(CrmPermissionConvert.INSTANCE.convert(permission, userList, deptMap, postMap));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.crm.convert.permission;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionCreateReqVO;
|
||||
|
@ -48,12 +49,12 @@ public interface CrmPermissionConvert {
|
|||
findAndThen(userMap, item.getUserId(), user -> {
|
||||
item.setNickname(user.getNickname());
|
||||
findAndThen(deptMap, user.getDeptId(), deptRespDTO -> item.setDeptName(deptRespDTO.getName()));
|
||||
if (user.getPostIds() == null) {
|
||||
if (CollUtil.isEmpty(user.getPostIds())) {
|
||||
item.setPostNames(Collections.emptySet());
|
||||
return;
|
||||
}
|
||||
List<PostRespDTO> postRespList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds());
|
||||
item.setPostNames(CollectionUtils.convertSet(postRespList, PostRespDTO::getName));
|
||||
List<PostRespDTO> postList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds());
|
||||
item.setPostNames(CollectionUtils.convertSet(postList, PostRespDTO::getName));
|
||||
});
|
||||
return item;
|
||||
});
|
||||
|
@ -64,6 +65,7 @@ public interface CrmPermissionConvert {
|
|||
id -> new CrmPermissionDO().setId(id).setLevel(updateReqVO.getLevel()));
|
||||
}
|
||||
|
||||
// TODO @puhui999:搞成 BeanUtils
|
||||
List<CrmPermissionDO> convertList(List<CrmPermissionCreateReqBO> list);
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ public class CrmFollowUpRecordDO extends BaseDO {
|
|||
*/
|
||||
@TableField(typeHandler = StringListTypeHandler.class)
|
||||
private List<String> picUrls;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
|
|
|
@ -58,6 +58,7 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> {
|
|||
MPJLambdaWrapperX<CrmBusinessDO> query = new MPJLambdaWrapperX<>();
|
||||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_BUSINESS.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmBusinessDO.class).in(CrmBusinessDO::getId, ids).orderByDesc(CrmBusinessDO::getId);
|
||||
return selectJoinList(CrmBusinessDO.class, query);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
|
|||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(), ids, userId);
|
||||
query.selectAll(CrmClueDO.class).in(CrmClueDO::getId, ids).orderByDesc(CrmClueDO::getId);
|
||||
// 拼接自身的查询条件
|
||||
return selectJoinList(CrmClueDO.class, query);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> {
|
|||
MPJLambdaWrapperX<CrmContactDO> query = new MPJLambdaWrapperX<>();
|
||||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmContactDO.class).in(CrmContactDO::getId, ids).orderByDesc(CrmContactDO::getId);
|
||||
return selectJoinList(CrmContactDO.class, query);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
|
|||
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
|
||||
// 构建数据权限连表条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTACT.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmContractDO.class).in(CrmContractDO::getId, ids).orderByDesc(CrmContractDO::getId);
|
||||
return selectJoinList(CrmContractDO.class, query);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
||||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmCustomerDO.class).in(CrmCustomerDO::getId, ids).orderByDesc(CrmCustomerDO::getId);
|
||||
return selectJoinList(CrmCustomerDO.class, query);
|
||||
}
|
||||
|
|
|
@ -49,13 +49,13 @@ public interface CrmPermissionMapper extends BaseMapperX<CrmPermissionDO> {
|
|||
}
|
||||
|
||||
default CrmPermissionDO selectByIdAndUserId(Long id, Long userId) {
|
||||
return selectOne(new LambdaQueryWrapperX<CrmPermissionDO>()
|
||||
.eq(CrmPermissionDO::getId, id).eq(CrmPermissionDO::getUserId, userId));
|
||||
return selectOne(CrmPermissionDO::getId, id,
|
||||
CrmPermissionDO::getUserId, userId);
|
||||
}
|
||||
|
||||
default CrmPermissionDO selectByBizIdAndUserId(Long id, Long userId) {
|
||||
return selectOne(new LambdaQueryWrapperX<CrmPermissionDO>()
|
||||
.eq(CrmPermissionDO::getBizId, id).eq(CrmPermissionDO::getUserId, userId));
|
||||
default CrmPermissionDO selectByBizIdAndUserId(Long bizId, Long userId) {
|
||||
return selectOne(CrmPermissionDO::getBizId, bizId,
|
||||
CrmPermissionDO::getUserId, userId);
|
||||
}
|
||||
|
||||
default int deletePermission(Integer bizType, Long bizId) {
|
||||
|
|
|
@ -53,6 +53,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
|
|||
MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
|
||||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmReceivableDO.class).in(CrmReceivableDO::getId, ids).orderByDesc(CrmReceivableDO::getId);
|
||||
return selectJoinList(CrmReceivableDO.class, query);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
|
|||
MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
|
||||
// 拼接数据权限的查询条件
|
||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), ids, userId);
|
||||
// 拼接自身的查询条件
|
||||
query.selectAll(CrmReceivablePlanDO.class).in(CrmReceivablePlanDO::getId, ids).orderByDesc(CrmReceivablePlanDO::getId);
|
||||
return selectJoinList(CrmReceivablePlanDO.class, query);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
|
|||
return crmFollowUpRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@CrmPermission(bizTypeValue = "#pageReqVO.bizType", bizId = "#pageReqVO.bizId", level = CrmPermissionLevelEnum.READ)
|
||||
public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) {
|
||||
|
|
|
@ -48,8 +48,11 @@ public class CouponDO extends BaseDO {
|
|||
*
|
||||
* 枚举 {@link CouponStatusEnum}
|
||||
*/
|
||||
// TODO 芋艿:已作废?
|
||||
private Integer status;
|
||||
|
||||
// TODO 芋艿:发放 adminid?
|
||||
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 领取情况 BEGIN ==========
|
||||
|
|
|
@ -45,6 +45,7 @@ public class CouponTemplateDO extends BaseDO {
|
|||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
// TODO 芋艿:要不要改成 3 个状态??
|
||||
private Integer status;
|
||||
|
||||
// ========== 基本信息 END ==========
|
||||
|
@ -159,4 +160,7 @@ public class CouponTemplateDO extends BaseDO {
|
|||
private Integer useCount;
|
||||
// ========== 统计信息 END ==========
|
||||
|
||||
// TODO 芋艿:领取开始时间、领取结束时间
|
||||
|
||||
// TODO 芋艿:要不要加描述
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue