Commit 88cb683752e157d00cda05847a18e1b77a204df6
1 parent
dd6981d9
CRM: 完善回款
Showing
9 changed files
with
51 additions
and
19 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| @@ -221,4 +221,13 @@ public class CrmContractController { | @@ -221,4 +221,13 @@ public class CrmContractController { | ||
| 221 | return success(contractService.getEndContractCount(getLoginUserId())); | 221 | return success(contractService.getEndContractCount(getLoginUserId())); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | + @GetMapping("/list-all-simple-by-customer") | ||
| 225 | + @Operation(summary = "获得合同精简列表", description = "只包含有读权限的客户的合同,主要用于前端的下拉选项") | ||
| 226 | + @Parameter(name = "customerId", description = "客户编号", required = true) | ||
| 227 | + @PreAuthorize("@ss.hasPermission('crm:contract:query')") | ||
| 228 | + public CommonResult<List<CrmContractRespVO>> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId) { | ||
| 229 | + PageResult<CrmContractDO> result = contractService.getContractPageByCustomerId(new CrmContractPageReqVO().setCustomerId(customerId)); | ||
| 230 | + return success(BeanUtils.toBean(result.getList(), CrmContractRespVO.class)); | ||
| 231 | + } | ||
| 232 | + | ||
| 224 | } | 233 | } |
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 { | @@ -153,7 +153,7 @@ public class CrmReceivableController { | ||
| 153 | 153 | ||
| 154 | @PutMapping("/submit") | 154 | @PutMapping("/submit") |
| 155 | @Operation(summary = "提交回款审批") | 155 | @Operation(summary = "提交回款审批") |
| 156 | - @PreAuthorize("@ss.hasPermission('crm:receivable:submit')") | 156 | + @PreAuthorize("@ss.hasPermission('crm:receivable:update')") |
| 157 | public CommonResult<Boolean> submitContract(@RequestParam("id") Long id) { | 157 | public CommonResult<Boolean> submitContract(@RequestParam("id") Long id) { |
| 158 | receivableService.submitReceivable(id, getLoginUserId()); | 158 | receivableService.submitReceivable(id, getLoginUserId()); |
| 159 | return success(true); | 159 | return success(true); |
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; | @@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 24 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 24 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 25 | import io.swagger.v3.oas.annotations.Operation; | 25 | import io.swagger.v3.oas.annotations.Operation; |
| 26 | import io.swagger.v3.oas.annotations.Parameter; | 26 | import io.swagger.v3.oas.annotations.Parameter; |
| 27 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 27 | import io.swagger.v3.oas.annotations.tags.Tag; | 28 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 28 | import jakarta.annotation.Resource; | 29 | import jakarta.annotation.Resource; |
| 29 | import jakarta.servlet.http.HttpServletResponse; | 30 | import jakarta.servlet.http.HttpServletResponse; |
| @@ -159,4 +160,18 @@ public class CrmReceivablePlanController { | @@ -159,4 +160,18 @@ public class CrmReceivablePlanController { | ||
| 159 | return success(receivablePlanService.getRemindReceivablePlanCount(getLoginUserId())); | 160 | return success(receivablePlanService.getRemindReceivablePlanCount(getLoginUserId())); |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 163 | + @GetMapping("/list-all-simple-by-customer") | ||
| 164 | + @Operation(summary = "获得回款计划精简列表", description = "获得回款计划精简列表,主要用于前端的下拉选项") | ||
| 165 | + @Parameters({ | ||
| 166 | + @Parameter(name = "customerId", description = "客户编号", required = true), | ||
| 167 | + @Parameter(name = "contractId", description = "合同编号", required = true) | ||
| 168 | + }) | ||
| 169 | + @PreAuthorize("@ss.hasPermission('crm:receivable-plan:query')") | ||
| 170 | + public CommonResult<List<CrmReceivablePlanRespVO>> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId, | ||
| 171 | + @RequestParam("contractId") Long contractId) { | ||
| 172 | + PageResult<CrmReceivablePlanDO> result = receivablePlanService.getReceivablePlanPageByCustomerId( | ||
| 173 | + new CrmReceivablePlanPageReqVO().setCustomerId(customerId).setContractId(contractId)); | ||
| 174 | + return success(BeanUtils.toBean(result.getList(), CrmReceivablePlanRespVO.class)); | ||
| 175 | + } | ||
| 176 | + | ||
| 162 | } | 177 | } |
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 { | @@ -30,8 +30,10 @@ public class CrmReceivablePlanPageReqVO extends PageParam { | ||
| 30 | @Schema(description = "客户编号", example = "18026") | 30 | @Schema(description = "客户编号", example = "18026") |
| 31 | private Long customerId; | 31 | private Long customerId; |
| 32 | 32 | ||
| 33 | - // TODO @芋艿:这个搜的应该是合同编号 no | ||
| 34 | - @Schema(description = "合同名称", example = "3473") | 33 | + @Schema(description = "合同编号", example = "H3473") |
| 34 | + private String contractNo; | ||
| 35 | + | ||
| 36 | + @Schema(description = "合同编号", example = "3473") | ||
| 35 | private Long contractId; | 37 | private Long contractId; |
| 36 | 38 | ||
| 37 | @Schema(description = "场景类型", example = "1") | 39 | @Schema(description = "场景类型", example = "1") |
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 { | @@ -37,6 +37,10 @@ public class CrmReceivablePlanSaveReqVO { | ||
| 37 | @NotNull(message = "计划回款金额不能为空") | 37 | @NotNull(message = "计划回款金额不能为空") |
| 38 | private BigDecimal price; | 38 | private BigDecimal price; |
| 39 | 39 | ||
| 40 | + @Schema(description = "提醒日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 41 | + @NotNull(message = "提醒日期不能为空") | ||
| 42 | + private LocalDateTime remindTime; | ||
| 43 | + | ||
| 40 | @Schema(description = "提前几天提醒", example = "1") | 44 | @Schema(description = "提前几天提醒", example = "1") |
| 41 | private Integer remindDays; | 45 | private Integer remindDays; |
| 42 | 46 |
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 { | @@ -38,9 +38,6 @@ public class CrmReceivableRespVO { | ||
| 38 | @Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 38 | @Schema(description = "负责人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 39 | private Long ownerUserId; | 39 | private Long ownerUserId; |
| 40 | 40 | ||
| 41 | - @Schema(description = "显示顺序") | ||
| 42 | - private Integer sort; | ||
| 43 | - | ||
| 44 | @Schema(description = "备注", example = "备注") | 41 | @Schema(description = "备注", example = "备注") |
| 45 | private String remark; | 42 | private String remark; |
| 46 | 43 |
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 { | @@ -46,9 +46,6 @@ public class CrmReceivableSaveReqVO { | ||
| 46 | @NotNull(message = "负责人编号不能为空") | 46 | @NotNull(message = "负责人编号不能为空") |
| 47 | private Long ownerUserId; | 47 | private Long ownerUserId; |
| 48 | 48 | ||
| 49 | - @Schema(description = "显示顺序") | ||
| 50 | - private Integer sort; | ||
| 51 | - | ||
| 52 | @Schema(description = "备注", example = "备注") | 49 | @Schema(description = "备注", example = "备注") |
| 53 | private String remark; | 50 | private String remark; |
| 54 | 51 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
| @@ -68,10 +68,6 @@ public class CrmReceivableDO extends BaseDO { | @@ -68,10 +68,6 @@ public class CrmReceivableDO extends BaseDO { | ||
| 68 | */ | 68 | */ |
| 69 | private BigDecimal price; | 69 | private BigDecimal price; |
| 70 | /** | 70 | /** |
| 71 | - * 显示顺序 | ||
| 72 | - */ | ||
| 73 | - private Integer sort; | ||
| 74 | - /** | ||
| 75 | * 备注 | 71 | * 备注 |
| 76 | */ | 72 | */ |
| 77 | private String remark; | 73 | private String remark; |
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; | @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.crm.dal.mysql.receivable; | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; |
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | ||
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| 10 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | 10 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 11 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; | 11 | import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; |
| @@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper; | @@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 15 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
| 16 | import java.util.Collection; | 16 | import java.util.Collection; |
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | +import java.util.Objects; | ||
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * 回款计划 Mapper | 21 | * 回款计划 Mapper |
| @@ -25,10 +26,15 @@ import java.util.List; | @@ -25,10 +26,15 @@ import java.util.List; | ||
| 25 | public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO> { | 26 | public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO> { |
| 26 | 27 | ||
| 27 | default PageResult<CrmReceivablePlanDO> selectPageByCustomerId(CrmReceivablePlanPageReqVO reqVO) { | 28 | default PageResult<CrmReceivablePlanDO> selectPageByCustomerId(CrmReceivablePlanPageReqVO reqVO) { |
| 28 | - return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>() | ||
| 29 | - .eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 | 29 | + MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); |
| 30 | + if (Objects.nonNull(reqVO.getContractNo())) { // 根据合同编号检索 | ||
| 31 | + query.innerJoin(CrmContractDO.class, on -> on.like(CrmContractDO::getNo, reqVO.getContractNo()) | ||
| 32 | + .eq(CrmContractDO::getId, CrmReceivablePlanDO::getContractId)); | ||
| 33 | + } | ||
| 34 | + query.eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递 | ||
| 30 | .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId()) | 35 | .eqIfPresent(CrmReceivablePlanDO::getContractId, reqVO.getContractId()) |
| 31 | - .orderByDesc(CrmReceivablePlanDO::getId)); | 36 | + .orderByDesc(CrmReceivablePlanDO::getPeriod); |
| 37 | + return selectJoinPage(reqVO, CrmReceivablePlanDO.class, query); | ||
| 32 | } | 38 | } |
| 33 | 39 | ||
| 34 | default PageResult<CrmReceivablePlanDO> selectPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId) { | 40 | default PageResult<CrmReceivablePlanDO> selectPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId) { |
| @@ -40,7 +46,12 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | @@ -40,7 +46,12 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | ||
| 40 | query.selectAll(CrmReceivablePlanDO.class) | 46 | query.selectAll(CrmReceivablePlanDO.class) |
| 41 | .eqIfPresent(CrmReceivablePlanDO::getCustomerId, pageReqVO.getCustomerId()) | 47 | .eqIfPresent(CrmReceivablePlanDO::getCustomerId, pageReqVO.getCustomerId()) |
| 42 | .eqIfPresent(CrmReceivablePlanDO::getContractId, pageReqVO.getContractId()) | 48 | .eqIfPresent(CrmReceivablePlanDO::getContractId, pageReqVO.getContractId()) |
| 43 | - .orderByDesc(CrmReceivablePlanDO::getId); | 49 | + .orderByDesc(CrmReceivablePlanDO::getPeriod); |
| 50 | + | ||
| 51 | + if (Objects.nonNull(pageReqVO.getContractNo())) { // 根据合同编号检索 | ||
| 52 | + query.innerJoin(CrmContractDO.class, on -> on.like(CrmContractDO::getNo, pageReqVO.getContractNo()) | ||
| 53 | + .eq(CrmContractDO::getId, CrmReceivablePlanDO::getContractId)); | ||
| 54 | + } | ||
| 44 | 55 | ||
| 45 | // Backlog: 回款提醒类型 | 56 | // Backlog: 回款提醒类型 |
| 46 | // TODO: @dhb52 需要配置 提前提醒天数 | 57 | // TODO: @dhb52 需要配置 提前提醒天数 |
| @@ -55,7 +66,8 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | @@ -55,7 +66,8 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO | ||
| 55 | .lt(CrmReceivablePlanDO::getReturnTime, endOfToday); | 66 | .lt(CrmReceivablePlanDO::getReturnTime, endOfToday); |
| 56 | } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款 | 67 | } else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款 |
| 57 | query.isNotNull(CrmReceivablePlanDO::getReceivableId) | 68 | query.isNotNull(CrmReceivablePlanDO::getReceivableId) |
| 58 | - .between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));; | 69 | + .between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS)); |
| 70 | + ; | ||
| 59 | } | 71 | } |
| 60 | 72 | ||
| 61 | return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); | 73 | return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); |