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