mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
feat: CRM/backlog 提醒数量
This commit is contained in:
parent
a5d33692c1
commit
d23dfd4276
@ -104,4 +104,11 @@ public class CrmClueController {
|
|||||||
return success(Boolean.TRUE);
|
return success(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/follow-leads-count")
|
||||||
|
@Operation(summary = "获得分配给我的线索数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:clue:query')")
|
||||||
|
public CommonResult<Long> getFollowLeadsCount() {
|
||||||
|
return success(clueService.getFollowLeadsCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -192,4 +192,19 @@ public class CrmContractController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/check-contract-count")
|
||||||
|
@Operation(summary = "获得待审核合同数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:contract:query')")
|
||||||
|
public CommonResult<Long> getCheckContractCount() {
|
||||||
|
return success(contractService.getCheckContractCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/end-contract-count")
|
||||||
|
@Operation(summary = "获得即将到期的合同数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:contract:query')")
|
||||||
|
public CommonResult<Long> getEndContractCount() {
|
||||||
|
return success(contractService.getEndContractCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*;
|
|||||||
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
|
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService;
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService;
|
||||||
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
@ -149,6 +150,41 @@ 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-count")
|
||||||
|
@Operation(summary = "获得待进入公海客户数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
||||||
|
public CommonResult<Long> getPutInPoolRemindCustomerCount() {
|
||||||
|
// 获取公海配置 TODO @dbh52:合并到 getPutInPoolRemindCustomerPage 会更合适哈;
|
||||||
|
CrmCustomerPoolConfigDO poolConfigDO = customerPoolConfigService.getCustomerPoolConfig();
|
||||||
|
if (ObjUtil.isNull(poolConfigDO)
|
||||||
|
|| Boolean.FALSE.equals(poolConfigDO.getEnabled())
|
||||||
|
|| Boolean.FALSE.equals(poolConfigDO.getNotifyEnabled())) {
|
||||||
|
throw exception(CUSTOMER_POOL_CONFIG_NOT_EXISTS_OR_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
CrmCustomerPageReqVO pageVO = new CrmCustomerPageReqVO();
|
||||||
|
pageVO.setPool(null);
|
||||||
|
pageVO.setContactStatus(CrmCustomerPageReqVO.CONTACT_TODAY);
|
||||||
|
pageVO.setSceneType(CrmSceneTypeEnum.OWNER.getType());
|
||||||
|
|
||||||
|
return success(customerService.getPutInPoolRemindCustomerCount(pageVO, poolConfigDO, getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/today-customer-count")
|
||||||
|
@Operation(summary = "获得今日需联系客户数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
||||||
|
public CommonResult<Long> getTodayCustomerCount() {
|
||||||
|
return success(customerService.getTodayCustomerCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/follow-customer-count")
|
||||||
|
@Operation(summary = "获得分配给我的客户数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
||||||
|
public CommonResult<Long> getFollowCustomerCount() {
|
||||||
|
return success(customerService.getFollowCustomerCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取距离进入公海的时间
|
* 获取距离进入公海的时间
|
||||||
*
|
*
|
||||||
|
@ -144,4 +144,12 @@ public class CrmReceivableController {
|
|||||||
return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList);
|
return CrmReceivableConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/check-receivables-count")
|
||||||
|
@Operation(summary = "获得待审核回款数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
||||||
|
public CommonResult<Long> getCheckReceivablesCount() {
|
||||||
|
return success(receivableService.getCheckReceivablesCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -153,4 +153,12 @@ public class CrmReceivablePlanController {
|
|||||||
return CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList, receivableList);
|
return CrmReceivablePlanConvert.INSTANCE.convertPage(pageResult, userMap, customerList, contractList, receivableList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/remind-receivable-plan-count")
|
||||||
|
@Operation(summary = "获得待回款提醒数量")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')")
|
||||||
|
public CommonResult<Long> getRemindReceivablesCount() {
|
||||||
|
return success(receivablePlanService.getRemindReceivablePlanCount(getLoginUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
|||||||
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -53,4 +54,17 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
|
|||||||
return selectJoinList(CrmClueDO.class, query);
|
return selectJoinList(CrmClueDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long getFollowLeadsCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_LEADS.getType(),
|
||||||
|
CrmClueDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 未跟进, 未转化
|
||||||
|
query.ne(CrmClueDO::getFollowUpStatus, true)
|
||||||
|
.ne(CrmClueDO::getTransformStatus, true);
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageR
|
|||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -90,4 +91,33 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> {
|
|||||||
return selectCount(CrmContractDO::getBusinessId, businessId);
|
return selectCount(CrmContractDO::getBusinessId, businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long getCheckContractCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(),
|
||||||
|
CrmContractDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 未提交 or 审核不通过
|
||||||
|
query.in(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.DRAFT.getStatus(), CrmAuditStatusEnum.REJECT.getStatus());
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Long getEndContractCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(),
|
||||||
|
CrmContractDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 即将到期
|
||||||
|
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
||||||
|
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
|
||||||
|
int REMIND_DAYS = 20;
|
||||||
|
query.eq(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.APPROVE.getStatus())
|
||||||
|
.between(CrmContractDO::getEndTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@ -29,6 +31,40 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
||||||
|
|
||||||
|
private static MPJLambdaWrapperX<CrmCustomerDO> buildPutInPoolRemindCustomerWrapper(CrmCustomerPageReqVO pageReqVO, CrmCustomerPoolConfigDO poolConfigDO, Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
// 拼接数据权限的查询条件
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
||||||
|
CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null);
|
||||||
|
|
||||||
|
// 锁定状态不需要提醒
|
||||||
|
query.ne(CrmCustomerDO::getLockStatus, true);
|
||||||
|
|
||||||
|
// 情况一:未成交提醒日期区间
|
||||||
|
Integer dealExpireDays = poolConfigDO.getDealExpireDays();
|
||||||
|
LocalDateTime startDealRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
||||||
|
.minusDays(dealExpireDays);
|
||||||
|
LocalDateTime endDealRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
||||||
|
.minusDays(Math.max(dealExpireDays - poolConfigDO.getNotifyDays(), 0));
|
||||||
|
// 情况二:未跟进提醒日期区间
|
||||||
|
Integer contactExpireDays = poolConfigDO.getContactExpireDays();
|
||||||
|
LocalDateTime startContactRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
||||||
|
.minusDays(contactExpireDays);
|
||||||
|
LocalDateTime endContactRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
||||||
|
.minusDays(Math.max(contactExpireDays - poolConfigDO.getNotifyDays(), 0));
|
||||||
|
query
|
||||||
|
// 情况一:1. 未成交放入公海提醒
|
||||||
|
.eq(CrmCustomerDO::getDealStatus, false)
|
||||||
|
.between(CrmCustomerDO::getCreateTime, startDealRemindDate, endDealRemindDate)
|
||||||
|
// 情况二:未跟进放入公海提醒
|
||||||
|
.or() // 2.1 contactLastTime 为空 TODO 芋艿:这个要不要搞个默认值;
|
||||||
|
.isNull(CrmCustomerDO::getContactLastTime)
|
||||||
|
.between(CrmCustomerDO::getCreateTime, startContactRemindDate, endContactRemindDate)
|
||||||
|
.or() // 2.2 ContactLastTime 不为空
|
||||||
|
.between(CrmCustomerDO::getContactLastTime, startContactRemindDate, endContactRemindDate);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
default Long selectCountByLockStatusAndOwnerUserId(Boolean lockStatus, Long ownerUserId) {
|
default Long selectCountByLockStatusAndOwnerUserId(Boolean lockStatus, Long ownerUserId) {
|
||||||
return selectCount(new LambdaUpdateWrapper<CrmCustomerDO>()
|
return selectCount(new LambdaUpdateWrapper<CrmCustomerDO>()
|
||||||
.eq(CrmCustomerDO::getLockStatus, lockStatus)
|
.eq(CrmCustomerDO::getLockStatus, lockStatus)
|
||||||
@ -102,39 +138,42 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
default PageResult<CrmCustomerDO> selectPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageReqVO,
|
default PageResult<CrmCustomerDO> selectPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageReqVO,
|
||||||
CrmCustomerPoolConfigDO poolConfigDO,
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
Long userId) {
|
Long userId) {
|
||||||
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
final MPJLambdaWrapperX<CrmCustomerDO> query = buildPutInPoolRemindCustomerWrapper(pageReqVO, poolConfigDO, userId);
|
||||||
// 拼接数据权限的查询条件
|
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query.selectAll(CrmCustomerDO.class));
|
||||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
|
||||||
CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null);
|
|
||||||
|
|
||||||
// 锁定状态不需要提醒
|
|
||||||
query.ne(CrmCustomerDO::getLockStatus, true);
|
|
||||||
|
|
||||||
// 拼接自身的查询条件
|
|
||||||
query.selectAll(CrmCustomerDO.class);
|
|
||||||
// 情况一:未成交提醒日期区间
|
|
||||||
Integer dealExpireDays = poolConfigDO.getDealExpireDays();
|
|
||||||
LocalDateTime startDealRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
|
||||||
.minusDays(dealExpireDays);
|
|
||||||
LocalDateTime endDealRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
|
||||||
.minusDays(Math.max(dealExpireDays - poolConfigDO.getNotifyDays(), 0));
|
|
||||||
// 情况二:未跟进提醒日期区间
|
|
||||||
Integer contactExpireDays = poolConfigDO.getContactExpireDays();
|
|
||||||
LocalDateTime startContactRemindDate = LocalDateTimeUtil.beginOfDay(LocalDateTime.now())
|
|
||||||
.minusDays(contactExpireDays);
|
|
||||||
LocalDateTime endContactRemindDate = LocalDateTimeUtil.endOfDay(LocalDateTime.now())
|
|
||||||
.minusDays(Math.max(contactExpireDays - poolConfigDO.getNotifyDays(), 0));
|
|
||||||
query
|
|
||||||
// 情况一:1. 未成交放入公海提醒
|
|
||||||
.eq(CrmCustomerDO::getDealStatus, false)
|
|
||||||
.between(CrmCustomerDO::getCreateTime, startDealRemindDate, endDealRemindDate)
|
|
||||||
// 情况二:未跟进放入公海提醒
|
|
||||||
.or() // 2.1 contactLastTime 为空 TODO 芋艿:这个要不要搞个默认值;
|
|
||||||
.isNull(CrmCustomerDO::getContactLastTime)
|
|
||||||
.between(CrmCustomerDO::getCreateTime, startContactRemindDate, endContactRemindDate)
|
|
||||||
.or() // 2.2 ContactLastTime 不为空
|
|
||||||
.between(CrmCustomerDO::getContactLastTime, startContactRemindDate, endContactRemindDate);
|
|
||||||
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long selectPutInPoolRemindCustomerCount(CrmCustomerPageReqVO pageReqVO,
|
||||||
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
|
Long userId) {
|
||||||
|
final MPJLambdaWrapperX<CrmCustomerDO> query = buildPutInPoolRemindCustomerWrapper(pageReqVO, poolConfigDO, userId);
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Long getTodayCustomerCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
||||||
|
CrmCustomerDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 今天需联系
|
||||||
|
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
||||||
|
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
|
||||||
|
query.between(CrmCustomerDO::getContactNextTime, beginOfToday, endOfToday);
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Long getFollowCustomerCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
||||||
|
CrmCustomerDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 未跟进
|
||||||
|
query.ne(CrmClueDO::getFollowUpStatus, true);
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -59,4 +62,17 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
|
|||||||
return selectJoinList(CrmReceivableDO.class, query);
|
return selectJoinList(CrmReceivableDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long getCheckReceivablesCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(),
|
||||||
|
CrmReceivableDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 未提交 or 审核不通过
|
||||||
|
query.in(CrmContractDO::getAuditStatus, CrmAuditStatusEnum.DRAFT.getStatus(), CrmAuditStatusEnum.REJECT.getStatus());
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
|||||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
||||||
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
import cn.iocoder.yudao.module.crm.util.CrmQueryWrapperUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -80,4 +81,19 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
|
|||||||
return selectJoinList(CrmReceivablePlanDO.class, query);
|
return selectJoinList(CrmReceivablePlanDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long getRemindReceivablePlanCount(Long userId) {
|
||||||
|
MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
|
||||||
|
|
||||||
|
// 我负责的, 非公海
|
||||||
|
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(),
|
||||||
|
CrmReceivablePlanDO::getId, userId, CrmSceneTypeEnum.OWNER.getType(), Boolean.FALSE);
|
||||||
|
|
||||||
|
// 待回款
|
||||||
|
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
||||||
|
query.isNull(CrmReceivablePlanDO::getReceivableId)
|
||||||
|
.gt(CrmReceivablePlanDO::getReturnTime, beginOfToday)
|
||||||
|
.apply("to_days(return_time) <= to_days(now())+ remind_days");
|
||||||
|
|
||||||
|
return selectCount(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,4 +90,12 @@ public interface CrmClueService {
|
|||||||
*/
|
*/
|
||||||
void translateCustomer(CrmClueTranslateReqVO reqVO, Long userId);
|
void translateCustomer(CrmClueTranslateReqVO reqVO, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得分配给我的线索数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getFollowLeadsCount(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -276,4 +276,9 @@ public class CrmClueServiceImpl implements CrmClueService {
|
|||||||
return SpringUtil.getBean(getClass());
|
return SpringUtil.getBean(getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getFollowLeadsCount(Long userId) {
|
||||||
|
return clueMapper.getFollowLeadsCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,4 +134,21 @@ public interface CrmContractService {
|
|||||||
*/
|
*/
|
||||||
Long getContractCountByBusinessId(Long businessId);
|
Long getContractCountByBusinessId(Long businessId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得待审核合同数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getCheckContractCount(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得即将到期的合同数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getEndContractCount(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -314,4 +314,15 @@ public class CrmContractServiceImpl implements CrmContractService {
|
|||||||
return contractMapper.selectCountByBusinessId(businessId);
|
return contractMapper.selectCountByBusinessId(businessId);
|
||||||
}
|
}
|
||||||
// TODO @合同待定:需要新增一个 ContractConfigDO 表,合同配置,重点是到期提醒;
|
// TODO @合同待定:需要新增一个 ContractConfigDO 表,合同配置,重点是到期提醒;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCheckContractCount(Long userId) {
|
||||||
|
return contractMapper.getCheckContractCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getEndContractCount(Long userId) {
|
||||||
|
return contractMapper.getEndContractCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,43 @@ public interface CrmCustomerService {
|
|||||||
*/
|
*/
|
||||||
int autoPutCustomerPool();
|
int autoPutCustomerPool();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得放入公海提醒的客户分页数据
|
||||||
|
*
|
||||||
|
* @param pageVO 分页查询
|
||||||
|
* @param poolConfigDO 公海配置
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 客户分页
|
||||||
|
*/
|
||||||
PageResult<CrmCustomerDO> getPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageVO,
|
PageResult<CrmCustomerDO> getPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageVO,
|
||||||
CrmCustomerPoolConfigDO poolConfigDO,
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
Long loginUserId);
|
Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得今日需联系客户数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getTodayCustomerCount(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得待进入公海的客户数量
|
||||||
|
*
|
||||||
|
* @param pageVO 分页查询
|
||||||
|
* @param poolConfigDO 公海配置
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getPutInPoolRemindCustomerCount(CrmCustomerPageReqVO pageVO,
|
||||||
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
|
Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得分配给我的客户数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getFollowCustomerCount(Long userId);
|
||||||
}
|
}
|
||||||
|
@ -465,12 +465,30 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
|||||||
return customerMapper.selectPage(pageReqVO, userId);
|
return customerMapper.selectPage(pageReqVO, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PageResult<CrmCustomerDO> getPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageReqVO,
|
public PageResult<CrmCustomerDO> getPutInPoolRemindCustomerPage(CrmCustomerPageReqVO pageReqVO,
|
||||||
CrmCustomerPoolConfigDO poolConfigDO,
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
Long userId) {
|
Long userId) {
|
||||||
return customerMapper.selectPutInPoolRemindCustomerPage(pageReqVO, poolConfigDO, userId);
|
return customerMapper.selectPutInPoolRemindCustomerPage(pageReqVO, poolConfigDO, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getPutInPoolRemindCustomerCount(CrmCustomerPageReqVO pageReqVO,
|
||||||
|
CrmCustomerPoolConfigDO poolConfigDO,
|
||||||
|
Long userId) {
|
||||||
|
return customerMapper.selectPutInPoolRemindCustomerCount(pageReqVO, poolConfigDO, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getTodayCustomerCount(Long userId) {
|
||||||
|
return customerMapper.getTodayCustomerCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getFollowCustomerCount(Long userId) {
|
||||||
|
return customerMapper.getFollowCustomerCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
// ======================= 校验相关 =======================
|
// ======================= 校验相关 =======================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,4 +77,11 @@ public interface CrmReceivablePlanService {
|
|||||||
*/
|
*/
|
||||||
PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomerId(CrmReceivablePlanPageReqVO pageReqVO);
|
PageResult<CrmReceivablePlanDO> getReceivablePlanPageByCustomerId(CrmReceivablePlanPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得待回款提醒数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getRemindReceivablePlanCount(Long userId);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import com.mzt.logapi.context.LogRecordContext;
|
|||||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@ -163,4 +162,9 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
|
|||||||
return receivablePlanMapper.selectPageByCustomerId(pageReqVO);
|
return receivablePlanMapper.selectPageByCustomerId(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getRemindReceivablePlanCount(Long userId) {
|
||||||
|
return receivablePlanMapper.getRemindReceivablePlanCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,4 +78,12 @@ public interface CrmReceivableService {
|
|||||||
*/
|
*/
|
||||||
PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO);
|
PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得待审核回款数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getCheckReceivablesCount(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import com.mzt.logapi.context.LogRecordContext;
|
|||||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@ -183,4 +182,9 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
|
|||||||
return receivableMapper.selectPageByCustomerId(pageReqVO);
|
return receivableMapper.selectPageByCustomerId(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCheckReceivablesCount(Long userId) {
|
||||||
|
return receivableMapper.getCheckReceivablesCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user