mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
commit
51f52ff4b7
@ -1,41 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.backlog;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.backlog.vo.CrmTodayCustomerPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
|
||||||
import cn.iocoder.yudao.module.crm.service.message.CrmBacklogService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - CRM待办消息")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/crm/backlog")
|
|
||||||
@Validated
|
|
||||||
public class CrmBacklogController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CrmBacklogService crmMessageService;
|
|
||||||
|
|
||||||
// TODO 芋艿:未来可能合并到 CrmCustomerController
|
|
||||||
@GetMapping("/today-customer-page")
|
|
||||||
@Operation(summary = "今日需联系客户")
|
|
||||||
@PreAuthorize("@ss.hasPermission('crm:customer:query')")
|
|
||||||
public CommonResult<PageResult<CrmCustomerRespVO>> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO) {
|
|
||||||
PageResult<CrmCustomerDO> pageResult = crmMessageService.getTodayCustomerPage(pageReqVO, getLoginUserId());
|
|
||||||
return success(BeanUtils.toBean(pageResult, CrmCustomerRespVO.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.backlog.vo;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 今日需联系客户 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class CrmTodayCustomerPageReqVO extends PageParam {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系状态 - 今日需联系
|
|
||||||
*/
|
|
||||||
public static final int CONTACT_TODAY = 1;
|
|
||||||
/**
|
|
||||||
* 联系状态 - 已逾期
|
|
||||||
*/
|
|
||||||
public static final int CONTACT_EXPIRED = 2;
|
|
||||||
/**
|
|
||||||
* 联系状态 - 已联系
|
|
||||||
*/
|
|
||||||
public static final int CONTACT_ALREADY = 3;
|
|
||||||
|
|
||||||
@Schema(description = "联系状态", example = "1")
|
|
||||||
private Integer contactStatus;
|
|
||||||
|
|
||||||
@Schema(description = "场景类型", example = "1")
|
|
||||||
@InEnum(CrmSceneTypeEnum.class)
|
|
||||||
private Integer sceneType;
|
|
||||||
|
|
||||||
}
|
|
@ -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()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,4 +39,7 @@ public class CrmCluePageReqVO extends PageParam {
|
|||||||
@Schema(description = "客户来源", example = "1")
|
@Schema(description = "客户来源", example = "1")
|
||||||
private Integer source;
|
private Integer source;
|
||||||
|
|
||||||
|
@Schema(description = "跟进状态", example = "true")
|
||||||
|
private Boolean followUpStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -184,4 +184,19 @@ public class CrmContractController {
|
|||||||
return CrmContractConvert.INSTANCE.convertList(contractList, userMap, customerList, contactMap, businessMap, contractProductMap, productList);
|
return CrmContractConvert.INSTANCE.convertList(contractList, userMap, customerList, contactMap, businessMap, contractProductMap, productList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
@ -128,8 +129,7 @@ public class CrmCustomerController {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +148,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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取距离进入公海的时间
|
* 获取距离进入公海的时间
|
||||||
*
|
*
|
||||||
|
@ -14,6 +14,19 @@ import lombok.ToString;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class CrmCustomerPageReqVO extends PageParam {
|
public class CrmCustomerPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系状态 - 今日需联系
|
||||||
|
*/
|
||||||
|
public static final int CONTACT_TODAY = 1;
|
||||||
|
/**
|
||||||
|
* 联系状态 - 已逾期
|
||||||
|
*/
|
||||||
|
public static final int CONTACT_EXPIRED = 2;
|
||||||
|
/**
|
||||||
|
* 联系状态 - 已联系
|
||||||
|
*/
|
||||||
|
public static final int CONTACT_ALREADY = 3;
|
||||||
|
|
||||||
@Schema(description = "客户名称", example = "赵六")
|
@Schema(description = "客户名称", example = "赵六")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -36,4 +49,13 @@ public class CrmCustomerPageReqVO extends PageParam {
|
|||||||
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
|
@Schema(description = "是否为公海数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
|
||||||
private Boolean pool; // null 则表示为不是公海数据
|
private Boolean pool; // null 则表示为不是公海数据
|
||||||
|
|
||||||
|
@Schema(description = "联系状态", example = "1")
|
||||||
|
private Integer contactStatus; // backlog查询条件, null 则表示为不做查询
|
||||||
|
|
||||||
|
@Schema(description = "跟进状态", example = "true")
|
||||||
|
private Boolean followUpStatus; // backlog查询条件, null 则表示为不做查询
|
||||||
|
|
||||||
|
@Schema(description = "跟进状态", example = "true")
|
||||||
|
private Boolean followUpStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
@ -40,6 +41,7 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
|
|||||||
.eqIfPresent(CrmClueDO::getIndustryId, pageReqVO.getIndustryId())
|
.eqIfPresent(CrmClueDO::getIndustryId, pageReqVO.getIndustryId())
|
||||||
.eqIfPresent(CrmClueDO::getLevel, pageReqVO.getLevel())
|
.eqIfPresent(CrmClueDO::getLevel, pageReqVO.getLevel())
|
||||||
.eqIfPresent(CrmClueDO::getSource, pageReqVO.getSource())
|
.eqIfPresent(CrmClueDO::getSource, pageReqVO.getSource())
|
||||||
|
.eqIfPresent(CrmClueDO::getFollowUpStatus, pageReqVO.getFollowUpStatus())
|
||||||
.orderByDesc(CrmClueDO::getId);
|
.orderByDesc(CrmClueDO::getId);
|
||||||
return selectJoinPage(pageReqVO, CrmClueDO.class, query);
|
return selectJoinPage(pageReqVO, CrmClueDO.class, query);
|
||||||
}
|
}
|
||||||
@ -53,4 +55,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,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.contract.vo.CrmContractPageReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
|
||||||
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;
|
||||||
@ -87,4 +89,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,23 @@
|
|||||||
package cn.iocoder.yudao.module.crm.dal.mysql.customer;
|
package cn.iocoder.yudao.module.crm.dal.mysql.customer;
|
||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
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.backlog.vo.CrmTodayCustomerPageReqVO;
|
|
||||||
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;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -28,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)
|
||||||
@ -57,7 +94,26 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
.eqIfPresent(CrmCustomerDO::getMobile, pageReqVO.getMobile())
|
.eqIfPresent(CrmCustomerDO::getMobile, pageReqVO.getMobile())
|
||||||
.eqIfPresent(CrmCustomerDO::getIndustryId, pageReqVO.getIndustryId())
|
.eqIfPresent(CrmCustomerDO::getIndustryId, pageReqVO.getIndustryId())
|
||||||
.eqIfPresent(CrmCustomerDO::getLevel, pageReqVO.getLevel())
|
.eqIfPresent(CrmCustomerDO::getLevel, pageReqVO.getLevel())
|
||||||
.eqIfPresent(CrmCustomerDO::getSource, pageReqVO.getSource());
|
.eqIfPresent(CrmCustomerDO::getSource, pageReqVO.getSource())
|
||||||
|
.eqIfPresent(CrmCustomerDO::getFollowUpStatus, pageReqVO.getFollowUpStatus());
|
||||||
|
|
||||||
|
// backlog 查询
|
||||||
|
if (ObjUtil.isNotNull(pageReqVO.getContactStatus())) {
|
||||||
|
Assert.isNull(pageReqVO.getPool(), "[是否为公海数据]必须是null");
|
||||||
|
|
||||||
|
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
||||||
|
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
|
||||||
|
if (pageReqVO.getContactStatus().equals(CrmCustomerPageReqVO.CONTACT_TODAY)) { // 今天需联系
|
||||||
|
query.between(CrmCustomerDO::getContactNextTime, beginOfToday, endOfToday);
|
||||||
|
} else if (pageReqVO.getContactStatus().equals(CrmCustomerPageReqVO.CONTACT_EXPIRED)) { // 已逾期
|
||||||
|
query.lt(CrmCustomerDO::getContactNextTime, beginOfToday);
|
||||||
|
} else if (pageReqVO.getContactStatus().equals(CrmCustomerPageReqVO.CONTACT_ALREADY)) { // 已联系
|
||||||
|
query.between(CrmCustomerDO::getContactLastTime, beginOfToday, endOfToday);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("未知联系状态:" + pageReqVO.getContactStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,37 +126,6 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
|||||||
return selectJoinList(CrmCustomerDO.class, query);
|
return selectJoinList(CrmCustomerDO.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 待办事项 - 今日需联系客户
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页请求参数
|
|
||||||
* @param userId 当前用户ID
|
|
||||||
* @return 分页结果
|
|
||||||
*/
|
|
||||||
default PageResult<CrmCustomerDO> selectTodayCustomerPage(CrmTodayCustomerPageReqVO pageReqVO, Long userId) {
|
|
||||||
MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();
|
|
||||||
// 拼接数据权限的查询条件
|
|
||||||
CrmQueryWrapperUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
|
|
||||||
CrmCustomerDO::getId, userId, pageReqVO.getSceneType(), null);
|
|
||||||
|
|
||||||
// 拼接自身的查询条件
|
|
||||||
query.selectAll(CrmCustomerDO.class);
|
|
||||||
if (pageReqVO.getContactStatus() != null) {
|
|
||||||
LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
|
|
||||||
LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now());
|
|
||||||
if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_TODAY)) { // 今天需联系
|
|
||||||
query.between(CrmCustomerDO::getContactNextTime, beginOfToday, endOfToday);
|
|
||||||
} else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_EXPIRED)) { // 已逾期
|
|
||||||
query.lt(CrmCustomerDO::getContactNextTime, beginOfToday);
|
|
||||||
} else if (pageReqVO.getContactStatus().equals(CrmTodayCustomerPageReqVO.CONTACT_ALREADY)) { // 已联系
|
|
||||||
query.between(CrmCustomerDO::getContactLastTime, beginOfToday, endOfToday);
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("未知联系状态:" + pageReqVO.getContactStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<CrmCustomerDO> selectListByLockAndNotPool(Boolean lockStatus) {
|
default List<CrmCustomerDO> selectListByLockAndNotPool(Boolean lockStatus) {
|
||||||
return selectList(new LambdaQueryWrapper<CrmCustomerDO>()
|
return selectList(new LambdaQueryWrapper<CrmCustomerDO>()
|
||||||
.eq(CrmCustomerDO::getLockStatus, lockStatus)
|
.eq(CrmCustomerDO::getLockStatus, lockStatus)
|
||||||
@ -114,37 +139,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);
|
|
||||||
// TODO @dhb52:lock 的情况,不需要提醒哈;
|
|
||||||
|
|
||||||
// 拼接自身的查询条件
|
|
||||||
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;
|
||||||
@ -78,4 +79,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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageR
|
|||||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO;
|
||||||
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.dal.dataobject.contract.CrmContractProductDO;
|
|
||||||
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.service.followup.bo.CrmUpdateFollowUpReqBO;
|
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@ -135,12 +134,21 @@ public interface CrmContractService {
|
|||||||
*/
|
*/
|
||||||
Long getContractCountByBusinessId(Long businessId);
|
Long getContractCountByBusinessId(Long businessId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取合同商品列表
|
* 获得待审核合同数量
|
||||||
*
|
*
|
||||||
* @param contactId 合同编号
|
* @param userId 用户编号
|
||||||
* @return 合同商品列表
|
* @return 提醒数量
|
||||||
*/
|
*/
|
||||||
List<CrmContractProductDO> getContractProductListByContractId(Long contactId);
|
Long getCheckContractCount(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得即将到期的合同数量
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 提醒数量
|
||||||
|
*/
|
||||||
|
Long getEndContractCount(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -361,4 +361,15 @@ public class CrmContractServiceImpl implements CrmContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO @合同待定:需要新增一个 ContractConfigDO 表,合同配置,重点是到期提醒;
|
// TODO @合同待定:需要新增一个 ContractConfigDO 表,合同配置,重点是到期提醒;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCheckContractCount(Long userId) {
|
||||||
|
return contractMapper.getCheckContractCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getEndContractCount(Long userId) {
|
||||||
|
return contractMapper.getEndContractCount(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,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);
|
||||||
}
|
}
|
||||||
|
@ -466,12 +466,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);
|
||||||
|
}
|
||||||
|
|
||||||
// ======================= 校验相关 =======================
|
// ======================= 校验相关 =======================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.message;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.backlog.vo.CrmTodayCustomerPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CRM 待办消息 Service 接口
|
|
||||||
*
|
|
||||||
* @author dhb52
|
|
||||||
*/
|
|
||||||
public interface CrmBacklogService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据【联系状态】、【场景类型】筛选客户分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 分页数据
|
|
||||||
*/
|
|
||||||
PageResult<CrmCustomerDO> getTodayCustomerPage(@Valid CrmTodayCustomerPageReqVO pageReqVO, Long userId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.message;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.backlog.vo.CrmTodayCustomerPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 待办消息 Service 实现类
|
|
||||||
*
|
|
||||||
* @author dhb52
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Validated
|
|
||||||
public class CrmBacklogServiceImpl implements CrmBacklogService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CrmCustomerMapper customerMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<CrmCustomerDO> getTodayCustomerPage(CrmTodayCustomerPageReqVO pageReqVO, Long userId) {
|
|
||||||
return customerMapper.selectTodayCustomerPage(pageReqVO, 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