mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
code review:回款逻辑
This commit is contained in:
parent
71ce831d59
commit
b7900c2035
@ -4,12 +4,16 @@ import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
// TODO @liuhongfeng:这个状态,还是搞成专属 CrmReceivableDO 专属的 status;
|
||||
/**
|
||||
* 流程审批状态枚举类
|
||||
* 0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回
|
||||
* 0 未审核 1 审核通过 2 审核拒绝 3 审核中 4 已撤回 TODO @liuhongfeng:这一行可以删除,因为已经有枚举属性了哈;
|
||||
* @author 赤焰
|
||||
*/
|
||||
// TODO @liuhongfeng:可以使用 @Getter、@AllArgsConstructor 简化 get、构造方法
|
||||
public enum AuditStatusEnum implements IntArrayValuable {
|
||||
|
||||
// TODO @liuhongfeng:草稿 0;10 审核中;20 审核通过;30 审核拒绝;40 已撤回;主要是留好间隙,万一每个地方要做点拓展; 然后,枚举字段的顺序调整下,审批中,一定要放两个审批通过、拒绝前面哈;
|
||||
/**
|
||||
* 未审批
|
||||
*/
|
||||
@ -31,16 +35,12 @@ public enum AuditStatusEnum implements IntArrayValuable {
|
||||
*/
|
||||
AUDIT_RETURN(4, "已撤回");
|
||||
|
||||
// TODO liuhongfeng:value 改成 status;desc 改成 name;
|
||||
private final Integer value;
|
||||
private final String desc;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AuditStatusEnum::getValue).toArray();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @param desc
|
||||
*/
|
||||
AuditStatusEnum(Integer value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.iocoder.yudao.module.crm.enums;
|
||||
|
||||
// TODO @liuhongfeng:这个的作用是?
|
||||
/**
|
||||
* @author 赤焰
|
||||
*/
|
||||
|
||||
public enum ReturnTypeEnum {
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
|
||||
@Validated
|
||||
public class CrmReceivableController {
|
||||
|
||||
// TODO @liuhongfeng:crmReceivableService 可以使用 receivableService ;在自己模块里,相对简洁一点;
|
||||
@Resource
|
||||
private CrmReceivableService crmReceivableService;
|
||||
|
||||
|
@ -20,15 +20,19 @@ public class CrmReceivableBaseVO {
|
||||
@Schema(description = "回款编号",requiredMode = Schema.RequiredMode.REQUIRED, example = "31177")
|
||||
private String no;
|
||||
|
||||
// TODO @liuhongfeng:回款计划编号
|
||||
@Schema(description = "回款计划", example = "31177")
|
||||
private Long planId;
|
||||
|
||||
// TODO @liuhongfeng:客户编号
|
||||
@Schema(description = "客户名称", example = "4963")
|
||||
private Long customerId;
|
||||
|
||||
// TODO @liuhongfeng:客户编号
|
||||
@Schema(description = "合同名称", example = "30305")
|
||||
private Long contractId;
|
||||
|
||||
// TODO @liuhongfeng:这个字段,应该不是前端传递的噢,而是后端自己生成的
|
||||
@Schema(description = "审批状态", example = "1")
|
||||
@InEnum(AuditStatusEnum.class)
|
||||
private Integer checkStatus;
|
||||
@ -40,9 +44,10 @@ public class CrmReceivableBaseVO {
|
||||
@Schema(description = "回款方式", example = "2")
|
||||
private String returnType;
|
||||
|
||||
@Schema(description = "回款金额", example = "31859")
|
||||
@Schema(description = "回款金额,单位:分", example = "31859")
|
||||
private Integer price;
|
||||
|
||||
// TODO @liuhongfeng:负责人编号
|
||||
@Schema(description = "负责人", example = "22202")
|
||||
private Long ownerUserId;
|
||||
|
||||
@ -55,6 +60,7 @@ public class CrmReceivableBaseVO {
|
||||
@Schema(description = "备注", example = "备注")
|
||||
private String remark;
|
||||
|
||||
// TODO @liuhongfeng:这个字段,这个字段,应该不是前端传递的噢,而是后端自己生成的,所以不适合放在 base 里面;
|
||||
@Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
private Integer status;
|
||||
|
||||
|
@ -1,20 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import lombok.*;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* CRM 回款管理 Excel VO
|
||||
*
|
||||
* @author 赤焰
|
||||
*/
|
||||
// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
|
||||
@Data
|
||||
public class CrmReceivableExcelVO {
|
||||
|
||||
|
@ -8,9 +8,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* @author 赤焰
|
||||
*/
|
||||
// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
|
||||
@Schema(description = "管理后台 - CRM 回款 Excel 导出 Request VO,参数和 CrmReceivablePageReqVO 是一致的")
|
||||
@Data
|
||||
public class CrmReceivableExportReqVO {
|
||||
|
@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class CrmReceivablePageReqVO extends PageParam {
|
||||
|
||||
// TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,planId、customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
|
||||
|
||||
@Schema(description = "回款编号")
|
||||
private String no;
|
||||
|
||||
|
@ -20,6 +20,7 @@ public class CrmReceivablePlanBaseVO {
|
||||
@Schema(description = "期数", example = "1")
|
||||
private Integer period;
|
||||
|
||||
// TODO @liuhongfeng:回款计划编号
|
||||
@Schema(description = "回款计划", example = "19852")
|
||||
private Long receivableId;
|
||||
|
||||
@ -44,12 +45,15 @@ public class CrmReceivablePlanBaseVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime remindTime;
|
||||
|
||||
// TODO @liuhongfeng:客户编号
|
||||
@Schema(description = "客户名称", example = "18026")
|
||||
private Long customerId;
|
||||
|
||||
// TODO @liuhongfeng:合同编号
|
||||
@Schema(description = "合同名称", example = "3473")
|
||||
private Long contractId;
|
||||
|
||||
// TODO @liuhongfeng:负责人编号
|
||||
@Schema(description = "负责人", example = "17828")
|
||||
private Long ownerUserId;
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import lombok.*;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
|
||||
/**
|
||||
* CRM 回款计划 Excel VO
|
||||
*
|
||||
|
@ -1,13 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.receivable.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
// TODO liuhongfeng:导出可以等其它功能做完,统一在搞;
|
||||
@Schema(description = "管理后台 - CRM 回款计划 Excel 导出 Request VO,参数和 CrmReceivablePlanPageReqVO 是一致的")
|
||||
@Data
|
||||
public class CrmReceivablePlanExportReqVO {
|
||||
|
@ -17,6 +17,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class CrmReceivablePlanPageReqVO extends PageParam {
|
||||
|
||||
// TODO @liuhongfeng:可以根据需求,去除掉一些不要的过滤条件;另外,customerId、contractId、ownerUserId 注释不正确,应该都是对应的编号
|
||||
|
||||
@Schema(description = "完成状态", example = "2")
|
||||
private Integer status;
|
||||
|
||||
|
@ -32,9 +32,12 @@ public class CrmReceivableDO extends BaseDO {
|
||||
* 回款编号
|
||||
*/
|
||||
private String no;
|
||||
// TODO @liuhongfeng:“对应实体”,参考别的模块,关联 {@link TableField.MetaInfo#getJdbcType()}
|
||||
/**
|
||||
* 回款计划
|
||||
*
|
||||
* TODO @liuhongfeng:这个字段什么时候更新,也可以写下
|
||||
*
|
||||
* 对应实体 {@link CrmReceivablePlanDO}
|
||||
*/
|
||||
private Long planId;
|
||||
@ -50,6 +53,7 @@ public class CrmReceivableDO extends BaseDO {
|
||||
* 对应实体 {@link cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO}
|
||||
*/
|
||||
private Long contractId;
|
||||
// TODO @liuhongfeng:“对应字典”,参考别的模块,枚举 {@link XXXX};另外,这个字段就叫 status,整体状态,不只审批
|
||||
/**
|
||||
* 审批状态
|
||||
* 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS}
|
||||
@ -65,6 +69,7 @@ public class CrmReceivableDO extends BaseDO {
|
||||
* 回款日期
|
||||
*/
|
||||
private LocalDateTime returnTime;
|
||||
// TODO @liuhongfeng:少个枚举
|
||||
/**
|
||||
* 回款方式
|
||||
*/
|
||||
@ -73,10 +78,12 @@ public class CrmReceivableDO extends BaseDO {
|
||||
* 回款金额
|
||||
*/
|
||||
private Integer price;
|
||||
// TODO @liuhongfeng:少关联实体;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
// TODO @liuhongfeng:应该不需要 batchId 字段
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
|
@ -1,12 +1,13 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.receivable;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 回款计划 DO
|
||||
*
|
||||
@ -33,26 +34,32 @@ public class CrmReceivablePlanDO extends BaseDO {
|
||||
private Integer period;
|
||||
/**
|
||||
* 回款ID
|
||||
*
|
||||
* TODO @liuhongfeng:少关联实体;
|
||||
*/
|
||||
private Long receivableId;
|
||||
// TODO @liuhongfeng:还款计划,没有 status 和 checkStatus,改成 finishStatus Boolean;是否完成
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 审批状态
|
||||
*
|
||||
* 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_RECEIVABLE_CHECK_STATUS}
|
||||
* // TODO @liuhongfeng:关联的枚举
|
||||
*/
|
||||
private Integer checkStatus;
|
||||
/**
|
||||
* 工作流编号
|
||||
*
|
||||
* TODO @liuhongfeng:少关联实体;
|
||||
*/
|
||||
private Long processInstanceId;
|
||||
/**
|
||||
* 计划回款金额
|
||||
* 计划回款金额,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
@ -69,14 +76,20 @@ public class CrmReceivablePlanDO extends BaseDO {
|
||||
private LocalDateTime remindTime;
|
||||
/**
|
||||
* 客户 ID
|
||||
*
|
||||
* TODO @liuhongfeng:少关联实体;
|
||||
*/
|
||||
private Long customerId;
|
||||
/**
|
||||
* 合同 ID
|
||||
*
|
||||
* TODO @liuhongfeng:少关联实体;
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 负责人
|
||||
* 负责人 ID
|
||||
*
|
||||
* TODO @liuhongfeng:少关联实体;
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
/**
|
||||
|
@ -27,6 +27,7 @@ import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
|
||||
// TODO @liuhongfeng:参考 CrmReceivableServiceImpl 写的 todo 哈;
|
||||
/**
|
||||
* 回款计划 Service 实现类
|
||||
*
|
||||
|
@ -37,6 +37,7 @@ import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
@Validated
|
||||
public class CrmReceivableServiceImpl implements CrmReceivableService {
|
||||
|
||||
// TODO @liuhongfeng:crm 前缀,变量可以不带哈;
|
||||
@Resource
|
||||
private CrmReceivableMapper crmReceivableMapper;
|
||||
@Resource
|
||||
@ -46,10 +47,12 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
|
||||
@Resource
|
||||
private CrmReceivablePlanService crmReceivablePlanService;
|
||||
|
||||
// TODO @liuhongfeng:创建还款后,是不是什么时候,要更新 plan?
|
||||
@Override
|
||||
public Long createReceivable(CrmReceivableCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
CrmReceivableDO receivable = CrmReceivableConvert.INSTANCE.convert(createReqVO);
|
||||
// TODO @liuhongfeng:这里的括号要注意排版;
|
||||
if (ObjectUtil.isNull(receivable.getStatus())){
|
||||
receivable.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
}
|
||||
@ -57,16 +60,17 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
|
||||
receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue());
|
||||
}
|
||||
|
||||
// TODO @liuhongfeng:一般来说,逻辑的写法,是要先检查,后操作 db;所以,你这个 check 应该放到 CrmReceivableDO receivable 之前;
|
||||
// 校验
|
||||
checkReceivable(receivable);
|
||||
|
||||
crmReceivableMapper.insert(receivable);
|
||||
// 返回
|
||||
return receivable.getId();
|
||||
}
|
||||
|
||||
// TODO @liuhongfeng:这里的括号要注意排版;
|
||||
private void checkReceivable(CrmReceivableDO receivable) {
|
||||
|
||||
// TODO @liuhongfeng:这个放在参数校验合适
|
||||
if(ObjectUtil.isNull(receivable.getContractId())){
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user