commit
85c9524a2d
|
@ -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<List<CrmContractRespVO>> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId) {
|
||||
PageResult<CrmContractDO> result = contractService.getContractPageByCustomerId(new CrmContractPageReqVO().setCustomerId(customerId));
|
||||
return success(BeanUtils.toBean(result.getList(), CrmContractRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Boolean> submitContract(@RequestParam("id") Long id) {
|
||||
receivableService.submitReceivable(id, getLoginUserId());
|
||||
return success(true);
|
||||
|
|
|
@ -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<List<CrmReceivablePlanRespVO>> getListAllSimpleByCustomer(@RequestParam("customerId") Long customerId,
|
||||
@RequestParam("contractId") Long contractId) {
|
||||
PageResult<CrmReceivablePlanDO> result = receivablePlanService.getReceivablePlanPageByCustomerId(
|
||||
new CrmReceivablePlanPageReqVO().setCustomerId(customerId).setContractId(contractId));
|
||||
return success(BeanUtils.toBean(result.getList(), CrmReceivablePlanRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 时则表示全部
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -46,9 +46,6 @@ public class CrmReceivableSaveReqVO {
|
|||
@NotNull(message = "负责人编号不能为空")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "备注")
|
||||
private String remark;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class CrmContractProductDO extends BaseDO {
|
|||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 合同价格, 单位:分
|
||||
* 合同价格, 单位:元
|
||||
*/
|
||||
private BigDecimal contractPrice;
|
||||
/**
|
||||
|
|
|
@ -67,10 +67,6 @@ public class CrmReceivableDO extends BaseDO {
|
|||
* 计划回款金额,单位:元
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ public interface CrmReceivableMapper extends BaseMapperX<CrmReceivableDO> {
|
|||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivableDO>()
|
||||
.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<CrmReceivableDO> {
|
|||
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);
|
||||
|
|
|
@ -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<CrmReceivablePlanDO> {
|
||||
|
||||
default PageResult<CrmReceivablePlanDO> selectPageByCustomerId(CrmReceivablePlanPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmReceivablePlanDO>()
|
||||
.eq(CrmReceivablePlanDO::getCustomerId, reqVO.getCustomerId()) // 必须传递
|
||||
MPJLambdaWrapperX<CrmReceivablePlanDO> 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<CrmReceivablePlanDO> selectPage(CrmReceivablePlanPageReqVO pageReqVO, Long userId) {
|
||||
|
@ -40,7 +46,12 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
|
|||
query.selectAll(CrmReceivablePlanDO.class)
|
||||
.eqIfPresent(CrmReceivablePlanDO::getCustomerId, pageReqVO.getCustomerId())
|
||||
.eqIfPresent(CrmReceivablePlanDO::getContractId, pageReqVO.getContractId())
|
||||
.orderByDesc(CrmReceivablePlanDO::getId);
|
||||
.orderByDesc(CrmReceivablePlanDO::getPeriod);
|
||||
|
||||
if (Objects.nonNull(pageReqVO.getContractNo())) { // 根据合同编号检索
|
||||
query.innerJoin(CrmContractDO.class, on -> on.like(CrmContractDO::getNo, pageReqVO.getContractNo())
|
||||
.eq(CrmContractDO::getId, CrmReceivablePlanDO::getContractId));
|
||||
}
|
||||
|
||||
// Backlog: 回款提醒类型
|
||||
// TODO: @dhb52 需要配置 提前提醒天数
|
||||
|
@ -55,7 +66,8 @@ public interface CrmReceivablePlanMapper extends BaseMapperX<CrmReceivablePlanDO
|
|||
.lt(CrmReceivablePlanDO::getReturnTime, endOfToday);
|
||||
} else if (CrmReceivablePlanPageReqVO.REMIND_TYPE_RECEIVED.equals(pageReqVO.getRemindType())) { // 已回款
|
||||
query.isNotNull(CrmReceivablePlanDO::getReceivableId)
|
||||
.between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));;
|
||||
.between(CrmReceivablePlanDO::getReturnTime, beginOfToday, endOfToday.plusDays(REMIND_DAYS));
|
||||
;
|
||||
}
|
||||
|
||||
return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
|
||||
|
|
Loading…
Reference in New Issue