mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-08 15:21:52 +08:00
【新增】回款管理 功能
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
||||
import cn.iocoder.yudao.module.crm.service.receivable.ReceivableService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Tag(name = "管理后台 - 回款管理")
|
||||
@RestController
|
||||
@RequestMapping("/crm/receivable")
|
||||
@Validated
|
||||
public class ReceivableController {
|
||||
|
||||
@Resource
|
||||
private ReceivableService receivableService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建回款管理")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:create')")
|
||||
public CommonResult<Long> createReceivable(@Valid @RequestBody ReceivableCreateReqVO createReqVO) {
|
||||
return success(receivableService.createReceivable(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新回款管理")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:update')")
|
||||
public CommonResult<Boolean> updateReceivable(@Valid @RequestBody ReceivableUpdateReqVO updateReqVO) {
|
||||
receivableService.updateReceivable(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除回款管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:delete')")
|
||||
public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
|
||||
receivableService.deleteReceivable(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得回款管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
||||
public CommonResult<ReceivableRespVO> getReceivable(@RequestParam("id") Long id) {
|
||||
ReceivableDO receivable = receivableService.getReceivable(id);
|
||||
return success(ReceivableConvert.INSTANCE.convert(receivable));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得回款管理列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
||||
public CommonResult<List<ReceivableRespVO>> getReceivableList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<ReceivableDO> list = receivableService.getReceivableList(ids);
|
||||
return success(ReceivableConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得回款管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:query')")
|
||||
public CommonResult<PageResult<ReceivableRespVO>> getReceivablePage(@Valid ReceivablePageReqVO pageVO) {
|
||||
PageResult<ReceivableDO> pageResult = receivableService.getReceivablePage(pageVO);
|
||||
return success(ReceivableConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出回款管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('crm:receivable:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportReceivableExcel(@Valid ReceivableExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<ReceivableDO> list = receivableService.getReceivableList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<ReceivableExcelVO> datas = ReceivableConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "回款管理.xls", "数据", ReceivableExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 回款管理 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class ReceivableBaseVO {
|
||||
|
||||
@Schema(description = "回款编号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "回款计划ID", example = "31177")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "客户ID", example = "4963")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "合同ID", example = "30305")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "审批状态", example = "1")
|
||||
private Integer checkStatus;
|
||||
|
||||
@Schema(description = "工作流编号", example = "16568")
|
||||
private Long processInstanceId;
|
||||
|
||||
@Schema(description = "回款日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime returnTime;
|
||||
|
||||
@Schema(description = "回款方式", example = "2")
|
||||
private String returnType;
|
||||
|
||||
@Schema(description = "回款金额", example = "31859")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "负责人", example = "22202")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "批次", example = "2539")
|
||||
private Long batchId;
|
||||
|
||||
@Schema(description = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "数据范围(指定部门数组)")
|
||||
private String dataScopeDeptIds;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 回款管理创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ReceivableCreateReqVO extends ReceivableBaseVO {
|
||||
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
|
||||
/**
|
||||
* 回款管理 Excel VO
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Data
|
||||
public class ReceivableExcelVO {
|
||||
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("回款编号")
|
||||
private String no;
|
||||
|
||||
@ExcelProperty("回款计划ID")
|
||||
private Long planId;
|
||||
|
||||
@ExcelProperty("客户ID")
|
||||
private Long customerId;
|
||||
|
||||
@ExcelProperty("合同ID")
|
||||
private Long contractId;
|
||||
|
||||
@ExcelProperty(value = "审批状态", converter = DictConvert.class)
|
||||
@DictFormat("crm_receivable_check_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Integer checkStatus;
|
||||
|
||||
@ExcelProperty("工作流编号")
|
||||
private Long processInstanceId;
|
||||
|
||||
@ExcelProperty("回款日期")
|
||||
private LocalDateTime returnTime;
|
||||
|
||||
@ExcelProperty("回款方式")
|
||||
private String returnType;
|
||||
|
||||
@ExcelProperty("回款金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@ExcelProperty("负责人")
|
||||
private Long ownerUserId;
|
||||
|
||||
@ExcelProperty("批次")
|
||||
private Long batchId;
|
||||
|
||||
//@ExcelProperty("显示顺序")
|
||||
//private Integer sort;
|
||||
|
||||
//@ExcelProperty("数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)")
|
||||
//private Integer dataScope;
|
||||
|
||||
//@ExcelProperty("数据范围(指定部门数组)")
|
||||
//private String dataScopeDeptIds;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat("common_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Schema(description = "管理后台 - 回款管理 Excel 导出 Request VO,参数和 ReceivablePageReqVO 是一致的")
|
||||
@Data
|
||||
public class ReceivableExportReqVO {
|
||||
|
||||
@Schema(description = "回款编号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "回款计划ID", example = "31177")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "客户ID", example = "4963")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "合同ID", example = "30305")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "审批状态", example = "1")
|
||||
private Integer checkStatus;
|
||||
|
||||
@Schema(description = "工作流编号", example = "16568")
|
||||
private Long processInstanceId;
|
||||
|
||||
@Schema(description = "回款日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] returnTime;
|
||||
|
||||
@Schema(description = "回款方式", example = "2")
|
||||
private String returnType;
|
||||
|
||||
@Schema(description = "回款金额", example = "31859")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "负责人", example = "22202")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "批次", example = "2539")
|
||||
private Long batchId;
|
||||
|
||||
@Schema(description = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "数据范围(指定部门数组)")
|
||||
private String dataScopeDeptIds;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 回款管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ReceivablePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "回款编号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "回款计划ID", example = "31177")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "客户ID", example = "4963")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "合同ID", example = "30305")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "审批状态", example = "1")
|
||||
private Integer checkStatus;
|
||||
|
||||
@Schema(description = "工作流编号", example = "16568")
|
||||
private Long processInstanceId;
|
||||
|
||||
@Schema(description = "回款日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] returnTime;
|
||||
|
||||
@Schema(description = "回款方式", example = "2")
|
||||
private String returnType;
|
||||
|
||||
@Schema(description = "回款金额", example = "31859")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "负责人", example = "22202")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "批次", example = "2539")
|
||||
private Long batchId;
|
||||
|
||||
@Schema(description = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "数据范围(指定部门数组)")
|
||||
private String dataScopeDeptIds;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 回款管理 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ReceivableRespVO extends ReceivableBaseVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 回款管理更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ReceivableUpdateReqVO extends ReceivableBaseVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787")
|
||||
@NotNull(message = "ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.crm.convert.receivable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
||||
|
||||
/**
|
||||
* 回款管理 Convert
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReceivableConvert {
|
||||
|
||||
ReceivableConvert INSTANCE = Mappers.getMapper(ReceivableConvert.class);
|
||||
|
||||
ReceivableDO convert(ReceivableCreateReqVO bean);
|
||||
|
||||
ReceivableDO convert(ReceivableUpdateReqVO bean);
|
||||
|
||||
ReceivableRespVO convert(ReceivableDO bean);
|
||||
|
||||
List<ReceivableRespVO> convertList(List<ReceivableDO> list);
|
||||
|
||||
PageResult<ReceivableRespVO> convertPage(PageResult<ReceivableDO> page);
|
||||
|
||||
List<ReceivableExcelVO> convertList02(List<ReceivableDO> list);
|
||||
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.receivable;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 回款管理 DO
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
@TableName("crm_receivable")
|
||||
@KeySequence("crm_receivable_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReceivableDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 回款编号
|
||||
*/
|
||||
private String no;
|
||||
/**
|
||||
* 回款计划ID
|
||||
*/
|
||||
private Long planId;
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long customerId;
|
||||
/**
|
||||
* 合同ID
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 审批状态
|
||||
*
|
||||
* 枚举 {@link TODO crm_receivable_check_status 对应的类}
|
||||
*/
|
||||
private Integer checkStatus;
|
||||
/**
|
||||
* 工作流编号
|
||||
*/
|
||||
private Long processInstanceId;
|
||||
/**
|
||||
* 回款日期
|
||||
*/
|
||||
private LocalDateTime returnTime;
|
||||
/**
|
||||
* 回款方式
|
||||
*/
|
||||
private String returnType;
|
||||
/**
|
||||
* 回款金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private Long batchId;
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)
|
||||
*/
|
||||
private Integer dataScope;
|
||||
/**
|
||||
* 数据范围(指定部门数组)
|
||||
*/
|
||||
private String dataScopeDeptIds;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link TODO common_status 对应的类}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.mysql.receivable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
|
||||
|
||||
/**
|
||||
* 回款管理 Mapper
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReceivableMapper extends BaseMapperX<ReceivableDO> {
|
||||
|
||||
default PageResult<ReceivableDO> selectPage(ReceivablePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ReceivableDO>()
|
||||
.eqIfPresent(ReceivableDO::getNo, reqVO.getNo())
|
||||
.eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId())
|
||||
.eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId())
|
||||
.eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus())
|
||||
.eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime())
|
||||
.eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType())
|
||||
.eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
|
||||
.eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId())
|
||||
.eqIfPresent(ReceivableDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope())
|
||||
.eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds())
|
||||
.eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ReceivableDO::getId));
|
||||
}
|
||||
|
||||
default List<ReceivableDO> selectList(ReceivableExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ReceivableDO>()
|
||||
.eqIfPresent(ReceivableDO::getNo, reqVO.getNo())
|
||||
.eqIfPresent(ReceivableDO::getPlanId, reqVO.getPlanId())
|
||||
.eqIfPresent(ReceivableDO::getCustomerId, reqVO.getCustomerId())
|
||||
.eqIfPresent(ReceivableDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(ReceivableDO::getCheckStatus, reqVO.getCheckStatus())
|
||||
.eqIfPresent(ReceivableDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.betweenIfPresent(ReceivableDO::getReturnTime, reqVO.getReturnTime())
|
||||
.eqIfPresent(ReceivableDO::getReturnType, reqVO.getReturnType())
|
||||
.eqIfPresent(ReceivableDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(ReceivableDO::getOwnerUserId, reqVO.getOwnerUserId())
|
||||
.eqIfPresent(ReceivableDO::getBatchId, reqVO.getBatchId())
|
||||
.eqIfPresent(ReceivableDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(ReceivableDO::getDataScope, reqVO.getDataScope())
|
||||
.eqIfPresent(ReceivableDO::getDataScopeDeptIds, reqVO.getDataScopeDeptIds())
|
||||
.eqIfPresent(ReceivableDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ReceivableDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ReceivableDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ReceivableDO::getId));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.crm.service.receivable;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 回款管理 Service 接口
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
public interface ReceivableService {
|
||||
|
||||
/**
|
||||
* 创建回款管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createReceivable(@Valid ReceivableCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新回款管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateReceivable(@Valid ReceivableUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除回款管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteReceivable(Long id);
|
||||
|
||||
/**
|
||||
* 获得回款管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 回款管理
|
||||
*/
|
||||
ReceivableDO getReceivable(Long id);
|
||||
|
||||
/**
|
||||
* 获得回款管理列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 回款管理列表
|
||||
*/
|
||||
List<ReceivableDO> getReceivableList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得回款管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 回款管理分页
|
||||
*/
|
||||
PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得回款管理列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 回款管理列表
|
||||
*/
|
||||
List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO);
|
||||
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
package cn.iocoder.yudao.module.crm.service.receivable;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
||||
|
||||
import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
/**
|
||||
* 回款管理 Service 实现类
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ReceivableServiceImpl implements ReceivableService {
|
||||
|
||||
@Resource
|
||||
private ReceivableMapper receivableMapper;
|
||||
|
||||
@Override
|
||||
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
ReceivableDO receivable = ReceivableConvert.INSTANCE.convert(createReqVO);
|
||||
receivableMapper.insert(receivable);
|
||||
// 返回
|
||||
return receivable.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReceivable(ReceivableUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateReceivableExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ReceivableDO updateObj = ReceivableConvert.INSTANCE.convert(updateReqVO);
|
||||
receivableMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReceivable(Long id) {
|
||||
// 校验存在
|
||||
validateReceivableExists(id);
|
||||
// 删除
|
||||
receivableMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateReceivableExists(Long id) {
|
||||
if (receivableMapper.selectById(id) == null) {
|
||||
throw exception(RECEIVABLE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReceivableDO getReceivable(Long id) {
|
||||
return receivableMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReceivableDO> getReceivableList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return receivableMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReceivableDO> getReceivablePage(ReceivablePageReqVO pageReqVO) {
|
||||
return receivableMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReceivableDO> getReceivableList(ReceivableExportReqVO exportReqVO) {
|
||||
return receivableMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user