diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java index 9cce6c0d9..f04c62c68 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java @@ -229,4 +229,13 @@ public class CrmContractController { return success(contractService.getRemindContractCount(getLoginUserId())); } + @GetMapping("/list-all-simple-by-customer") + @Operation(summary = "获得合同精简列表", description = "只包含有读权限的客户的合同,主要用于前端的下拉选项") + @Parameter(name = "customerId", description = "客户编号", required = true) + @PreAuthorize("@ss.hasPermission('crm:contract:query')") + public CommonResult> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId) { + PageResult result = contractService.getContractPageByCustomerId(new CrmContractPageReqVO().setCustomerId(customerId)); + return success(BeanUtils.toBean(result.getList(), CrmContractRespVO.class)); + } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java index fcbbfed72..8afe2df79 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivableController.java @@ -153,7 +153,7 @@ public class CrmReceivableController { @PutMapping("/submit") @Operation(summary = "提交回款审批") - @PreAuthorize("@ss.hasPermission('crm:receivable:submit')") + @PreAuthorize("@ss.hasPermission('crm:receivable:update')") public CommonResult submitContract(@RequestParam("id") Long id) { receivableService.submitReceivable(id, getLoginUserId()); return success(true); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java index cbb9d51e4..18948c342 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/CrmReceivablePlanController.java @@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; @@ -159,4 +160,18 @@ public class CrmReceivablePlanController { return success(receivablePlanService.getRemindReceivablePlanCount(getLoginUserId())); } + @GetMapping("/list-all-simple-by-customer") + @Operation(summary = "获得回款计划精简列表", description = "获得回款计划精简列表,主要用于前端的下拉选项") + @Parameters({ + @Parameter(name = "customerId", description = "客户编号", required = true), + @Parameter(name = "contractId", description = "合同编号", required = true) + }) + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')") + public CommonResult> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId, + @RequestParam("contractId") Long contractId) { + PageResult result = receivablePlanService.getReceivablePlanPageByCustomerId( + new CrmReceivablePlanPageReqVO().setCustomerId(customerId).setContractId(contractId)); + return success(BeanUtils.toBean(result.getList(), CrmReceivablePlanRespVO.class)); + } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java index 3675fba1f..b730128ce 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanPageReqVO.java @@ -30,8 +30,10 @@ public class CrmReceivablePlanPageReqVO extends PageParam { @Schema(description = "客户编号", example = "18026") private Long customerId; - // TODO @芋艿:这个搜的应该是合同编号 no - @Schema(description = "合同名称", example = "3473") + @Schema(description = "合同编号", example = "H3473") + private String contractNo; + + @Schema(description = "合同编号", example = "3473") private Long contractId; @Schema(description = "场景类型", example = "1") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java index b2bb41242..51b688b02 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/plan/CrmReceivablePlanSaveReqVO.java @@ -37,6 +37,10 @@ public class CrmReceivablePlanSaveReqVO { @NotNull(message = "计划回款金额不能为空") private BigDecimal price; + @Schema(description = "提醒日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "提醒日期不能为空") + private LocalDateTime remindTime; + @Schema(description = "提前几天提醒", example = "1") private Integer remindDays; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java index e1fe83087..415816c5d 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivablePageReqVO.java @@ -24,6 +24,9 @@ public class CrmReceivablePageReqVO extends PageParam { @Schema(description = "客户编号", example = "4963") private Long customerId; + @Schema(description = "合同编号", example = "4963") + private Long contractId; + @Schema(description = "场景类型", example = "1") @InEnum(CrmSceneTypeEnum.class) private Integer sceneType; // 场景类型,为 null 时则表示全部 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java index 2bb721b46..13ae884b1 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableRespVO.java @@ -38,9 +38,6 @@ public class CrmReceivableRespVO { @Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") private Long ownerUserId; - @Schema(description = "显示顺序") - private Integer sort; - @Schema(description = "备注", example = "备注") private String remark; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java index dfc0b1553..fcd39b411 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/receivable/vo/receivable/CrmReceivableSaveReqVO.java @@ -46,9 +46,6 @@ public class CrmReceivableSaveReqVO { @NotNull(message = "负责人编号不能为空") private Long ownerUserId; - @Schema(description = "显示顺序") - private Integer sort; - @Schema(description = "备注", example = "备注") private String remark; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java index ec50e50be..6bb3e6bf0 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contract/CrmContractProductDO.java @@ -46,7 +46,7 @@ public class CrmContractProductDO extends BaseDO { */ private BigDecimal productPrice; /** - * 合同价格, 单位:分 + * 合同价格, 单位:元 */ private BigDecimal contractPrice; /** diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java index 3c8d71cd4..21b976975 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java @@ -67,10 +67,6 @@ public class CrmReceivableDO extends BaseDO { * 计划回款金额,单位:元 */ private BigDecimal price; - /** - * 显示顺序 - */ - private Integer sort; /** * 备注 */ diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java index a591131d5..a97e7ece2 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java @@ -28,6 +28,7 @@ public interface CrmReceivableMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eq(CrmReceivableDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 .eqIfPresent(CrmReceivableDO::getNo, reqVO.getNo()) + .eqIfPresent(CrmReceivableDO::getContractId, reqVO.getContractId()) .eqIfPresent(CrmReceivableDO::getPlanId, reqVO.getPlanId()) .orderByDesc(CrmReceivableDO::getId)); } @@ -41,6 +42,7 @@ public interface CrmReceivableMapper extends BaseMapperX { query.selectAll(CrmReceivableDO.class) .eqIfPresent(CrmReceivableDO::getNo, pageReqVO.getNo()) .eqIfPresent(CrmReceivableDO::getPlanId, pageReqVO.getPlanId()) + .eqIfPresent(CrmReceivableDO::getContractId, pageReqVO.getContractId()) .eqIfPresent(CrmReceivableDO::getAuditStatus, pageReqVO.getAuditStatus()) .orderByDesc(CrmReceivableDO::getId); return selectJoinPage(pageReqVO, CrmReceivableDO.class, query); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java index 4fac66a77..32c3d7cf1 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.crm.dal.mysql.receivable; import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.MPJLambdaWrapperX; import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; 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.CrmSceneTypeEnum; @@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper; import java.time.LocalDateTime; import java.util.Collection; import java.util.List; +import java.util.Objects; /** * 回款计划 Mapper @@ -25,10 +26,15 @@ import java.util.List; public interface CrmReceivablePlanMapper extends BaseMapperX { default PageResult selectPageByCustomerId(CrmReceivablePlanPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 + MPJLambdaWrapperX query = new MPJLambdaWrapperX<>(); + if (Objects.nonNull(reqVO.getContractNo())) { // 根据合同编号检索 + query.innerJoin(CrmContractDO.class, on -> on.like(CrmContractDO::getNo, reqVO.getContractNo()) + .eq(CrmContractDO::getId, CrmReceivablePlanDO::getContractId)); + } + query.eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId()) - .orderByDesc(CrmReceivablePlanDO::getId)); + .orderByDesc(CrmReceivablePlanDO::getPeriod); + return selectJoinPage(reqVO, CrmReceivablePlanDO.class, query); } default PageResult selectPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId) { @@ -40,7 +46,12 @@ public interface CrmReceivablePlanMapper extends BaseMapperX on.like(CrmContractDO::getNo, pageReqVO.getContractNo()) + .eq(CrmContractDO::getId, CrmReceivablePlanDO::getContractId)); + } // Backlog: 回款提醒类型 // TODO: @dhb52 需要配置 提前提醒天数 @@ -55,7 +66,8 @@ public interface CrmReceivablePlanMapper extends BaseMapperX