mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
📖 CRM:code review 待进入公海的客户
This commit is contained in:
parent
cd28128e42
commit
6f95f37117
@ -59,7 +59,6 @@ public class CrmCustomerController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AdminUserApi adminUserApi;
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建客户")
|
@Operation(summary = "创建客户")
|
||||||
@PreAuthorize("@ss.hasPermission('crm:customer:create')")
|
@PreAuthorize("@ss.hasPermission('crm:customer:create')")
|
||||||
@ -120,17 +119,16 @@ public class CrmCustomerController {
|
|||||||
return success(CrmCustomerConvert.INSTANCE.convertPage(pageResult, userMap, deptMap, poolDayMap));
|
return success(CrmCustomerConvert.INSTANCE.convertPage(pageResult, userMap, deptMap, poolDayMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/put-in-pool-remind-page")
|
@GetMapping("/put-in-pool-remind-page")
|
||||||
@Operation(summary = "获得待进入公海客户分页")
|
@Operation(summary = "获得待进入公海客户分页")
|
||||||
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
||||||
public CommonResult<PageResult<CrmCustomerRespVO>> getPutInPoolRemindCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
|
public CommonResult<PageResult<CrmCustomerRespVO>> getPutInPoolRemindCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
|
||||||
// 获取公海配置
|
// 获取公海配置 TODO @dbh52:合并到 getPutInPoolRemindCustomerPage 会更合适哈;
|
||||||
CrmCustomerPoolConfigDO poolConfigDO = customerPoolConfigService.getCustomerPoolConfig();
|
CrmCustomerPoolConfigDO poolConfigDO = customerPoolConfigService.getCustomerPoolConfig();
|
||||||
if (ObjUtil.isNull(poolConfigDO)
|
if (ObjUtil.isNull(poolConfigDO)
|
||||||
|| Boolean.FALSE.equals(poolConfigDO.getEnabled())
|
|| Boolean.FALSE.equals(poolConfigDO.getEnabled())
|
||||||
|| Boolean.FALSE.equals(poolConfigDO.getNotifyEnabled())
|
|| Boolean.FALSE.equals(poolConfigDO.getNotifyEnabled())
|
||||||
) {
|
) { // TODO @dbh52:这个括号,一般不换行,在 java 这里;
|
||||||
throw exception(CUSTOMER_POOL_CONFIG_NOT_EXISTS_OR_DISABLED);
|
throw exception(CUSTOMER_POOL_CONFIG_NOT_EXISTS_OR_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,11 +139,11 @@ public class CrmCustomerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. 拼接数据
|
// 2. 拼接数据
|
||||||
|
// TODO @芋艿:合并 getCustomerPage 和 getPutInPoolRemindCustomerPage 的后置处理;
|
||||||
Map<Long, Long> poolDayMap = getPoolDayMap(pageResult.getList()); // 客户界面,需要查看距离进入公海的时间
|
Map<Long, Long> poolDayMap = getPoolDayMap(pageResult.getList()); // 客户界面,需要查看距离进入公海的时间
|
||||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
|
||||||
convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId())));
|
convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId())));
|
||||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||||
|
|
||||||
return success(CrmCustomerConvert.INSTANCE.convertPage(pageResult, userMap, deptMap, poolDayMap));
|
return success(CrmCustomerConvert.INSTANCE.convertPage(pageResult, userMap, deptMap, poolDayMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,47 +115,32 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
// 拼接数据权限的查询条件
|
// 拼接数据权限的查询条件
|
||||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
||||||
CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null);
|
CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null);
|
||||||
|
// TODO @dhb52:lock 的情况,不需要提醒哈;
|
||||||
|
|
||||||
// 拼接自身的查询条件
|
// 拼接自身的查询条件
|
||||||
query.selectAll(CrmCustomerDO.class);
|
query.selectAll(CrmCustomerDO.class);
|
||||||
|
// 情况一:未成交提醒日期区间
|
||||||
// 未跟进放入公海天数
|
Integer dealExpireDays = poolConfigDO.getDealExpireDays();
|
||||||
final Integer contactExpireDays = poolConfigDO.getContactExpireDays();
|
|
||||||
// 未成交放入公海天数
|
|
||||||
final Integer dealExpireDays = poolConfigDO.getDealExpireDays();
|
|
||||||
// 提前提醒天数
|
|
||||||
final Integer notifyDays = poolConfigDO.getNotifyDays();
|
|
||||||
|
|
||||||
// 未成交提醒日期区间
|
|
||||||
// dealExpireDays 开始提醒
|
|
||||||
LocalDateTime startDealRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
LocalDateTime startDealRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
||||||
.minusDays(dealExpireDays);
|
.minusDays(dealExpireDays);
|
||||||
// dealExpireDays - notifyDays 结束提醒
|
|
||||||
LocalDateTime endDealRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
LocalDateTime endDealRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
||||||
.minusDays(Math.max(dealExpireDays - notifyDays, 0));
|
.minusDays(Math.max(dealExpireDays - poolConfigDO.getNotifyDays(), 0));
|
||||||
|
// 情况二:未跟进提醒日期区间
|
||||||
// 未跟进提醒日期区间
|
Integer contactExpireDays = poolConfigDO.getContactExpireDays();
|
||||||
// contactExpireDays 开始提醒
|
|
||||||
LocalDateTime startContactRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
LocalDateTime startContactRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
||||||
.minusDays(contactExpireDays);
|
.minusDays(contactExpireDays);
|
||||||
// contactExpireDays - notifyDays 结束提醒
|
|
||||||
LocalDateTime endContactRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
LocalDateTime endContactRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
||||||
.minusDays(Math.max(contactExpireDays - notifyDays, 0));
|
.minusDays(Math.max(contactExpireDays - poolConfigDO.getNotifyDays(), 0));
|
||||||
|
|
||||||
query
|
query
|
||||||
// 1.1 未成交放入公海提醒
|
// 情况一:1. 未成交放入公海提醒
|
||||||
.eq(CrmCustomerDO::getDealStatus, false)
|
.eq(CrmCustomerDO::getDealStatus, false)
|
||||||
.between(CrmCustomerDO::getCreateTime, startDealRemindDate, endDealRemindDate)
|
.between(CrmCustomerDO::getCreateTime, startDealRemindDate, endDealRemindDate)
|
||||||
.or()
|
// 情况二:未跟进放入公海提醒
|
||||||
// 1.2 未跟进放入公海提醒
|
.or() // 2.1 contactLastTime 为空 TODO 芋艿:这个要不要搞个默认值;
|
||||||
// 1.2.1 ContactLastTime 为空
|
|
||||||
.isNull(CrmCustomerDO::getContactLastTime)
|
.isNull(CrmCustomerDO::getContactLastTime)
|
||||||
.between(CrmCustomerDO::getCreateTime, startContactRemindDate, endContactRemindDate)
|
.between(CrmCustomerDO::getCreateTime, startContactRemindDate, endContactRemindDate)
|
||||||
.or()
|
.or() // 2.2 ContactLastTime 不为空
|
||||||
// 1.2.2 ContactLastTime 不为空
|
.between(CrmCustomerDO::getContactLastTime, startContactRemindDate, endContactRemindDate);
|
||||||
.between(CrmCustomerDO::getContactLastTime, startContactRemindDate, endContactRemindDate)
|
|
||||||
;
|
|
||||||
|
|
||||||
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user