code review:客户逻辑
This commit is contained in:
parent
9ee6a27b86
commit
ecf728966f
|
@ -33,6 +33,10 @@
|
|||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
|
@ -57,12 +61,6 @@
|
|||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 地址相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
|
|
|
@ -102,12 +102,15 @@ public class CrmCustomerController {
|
|||
public CommonResult<PageResult<CrmCustomerRespVO>> getCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
|
||||
PageResult<CrmCustomerDO> pageResult = customerService.getCustomerPage(pageVO);
|
||||
PageResult<CrmCustomerRespVO> pageVo = CrmCustomerConvert.INSTANCE.convertPage(pageResult);
|
||||
// TODO @wanwan: 可以参考 CollectionUtils.convertListByFlatMap(),目的是简洁
|
||||
Set<Long> userSet = pageVo.getList().stream().flatMap(i -> Stream.of(NumberUtil.parseLong(i.getCreator()), i.getOwnerUserId())).collect(Collectors.toSet());
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userSet);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(userMap.values().stream().map(AdminUserRespDTO::getDeptId).collect(Collectors.toSet()));
|
||||
// TODO @wanwan:这块可以形成一个 convertPage 方法,default 实现;
|
||||
pageVo.getList().forEach(customerRespVO -> {
|
||||
customerRespVO.setAreaName(AreaUtils.format(customerRespVO.getAreaId()));
|
||||
customerRespVO.setCreatorName(Optional.ofNullable(userMap.get(NumberUtil.parseLong(customerRespVO.getCreator()))).map(AdminUserRespDTO::getNickname).orElse(null));
|
||||
// TODO @wanwan:可以使用 MapUtils.findAndThen
|
||||
AdminUserRespDTO ownerUser = userMap.get(customerRespVO.getOwnerUserId());
|
||||
if (Objects.nonNull(ownerUser)) {
|
||||
customerRespVO.setOwnerUserName(ownerUser.getNickname());
|
||||
|
|
|
@ -30,10 +30,8 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO {
|
|||
|
||||
@Schema(description = "负责人的用户编号", example = "25682")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "负责人名字", example = "25682")
|
||||
private String ownerUserName;
|
||||
|
||||
@Schema(description = "负责人部门")
|
||||
private String ownerUserDept;
|
||||
|
||||
|
@ -52,7 +50,7 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO {
|
|||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建人名字")
|
||||
private String creatorName;
|
||||
|
||||
}
|
||||
|
|
|
@ -98,8 +98,11 @@ public class CrmCustomerDO extends BaseDO {
|
|||
private String remark;
|
||||
/**
|
||||
* 负责人的用户编号
|
||||
*
|
||||
* 关联 AdminUserDO 的 id 字段
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
// TODO @puhui999:这块抽到 permission 里;
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*/
|
||||
|
|
|
@ -65,6 +65,10 @@ public class CrmPermissionAspect {
|
|||
// TODO @puhui999:一般核心的方法,放到最前面,private 放后面。主要是,主次要分出来哈;
|
||||
@Before("@annotation(crmPermission)")
|
||||
public void doBefore(JoinPoint joinPoint, CrmPermission crmPermission) {
|
||||
// TODO 芋艿:临时,方便大家调试
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Long bizId = crmPermission.getIdFor().length > 0 ? getBizId(joinPoint, crmPermission) : (Long) joinPoint.getArgs()[0]; // 获取操作数据的编号
|
||||
Integer bizType = crmPermission.bizType().getType(); // 模块类型
|
||||
|
|
Loading…
Reference in New Issue