Commit 987e58fc by 崔彦峰

feat(clues): 添加线索最新跟进时间字段支持

- 在 CluesDetailResp、CluesInfo 和 CluesPageResp 中添加 latestFollowTime 字段
- 在 CluesWebPageReq 中添加最新跟进时间范围查询参数
- 更新数据库映射文件中的基础列列表和查询语句
- 修改 updateFollowInfo 方法以包含最新跟进时间更新逻辑
- 添加按最新跟进时间范围过滤的功能
- 在服务层实现最新跟进时间的数据处理和存储逻辑
1 parent a6c22f5c
...@@ -29,6 +29,9 @@ public class CluesDetailResp implements Serializable { ...@@ -29,6 +29,9 @@ public class CluesDetailResp implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "线索录入时间") @Schema(description = "线索录入时间")
private Date enterTime; private Date enterTime;
@Schema(description = "线索最新跟进时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date latestFollowTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "线索下一次跟进时间") @Schema(description = "线索下一次跟进时间")
private Date nextFollowTime; private Date nextFollowTime;
......
...@@ -26,6 +26,10 @@ public class CluesPageResp implements Serializable { ...@@ -26,6 +26,10 @@ public class CluesPageResp implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date enterTime; private Date enterTime;
@Schema(description = "线索最新跟进时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date latestFollowTime;
@Schema(description = "线索门店(销售(4S店)商户名称)") @Schema(description = "线索门店(销售(4S店)商户名称)")
private String sellerMerchantName; private String sellerMerchantName;
......
...@@ -76,6 +76,14 @@ public class CluesInfo implements Serializable { ...@@ -76,6 +76,14 @@ public class CluesInfo implements Serializable {
private Date enterTime; private Date enterTime;
/** /**
* 线索最新跟进时间
*/
@TableField(value = "latest_follow_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "线索最新跟进时间")
private Date latestFollowTime;
/**
* 线索下一次跟进时间 * 线索下一次跟进时间
*/ */
@TableField(value = "next_follow_time") @TableField(value = "next_follow_time")
......
...@@ -63,6 +63,14 @@ public class CluesWebPageReq implements Serializable { ...@@ -63,6 +63,14 @@ public class CluesWebPageReq implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date enterTimeEnd; private Date enterTimeEnd;
@Schema(description = "最新跟进时间开始")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date latestFollowTimeStart;
@Schema(description = "最新跟进时间结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date latestFollowTimeEnd;
// ========== 排序 ========== // ========== 排序 ==========
@Schema(description = "录入时间排序:0-升序 1-降序,默认1") @Schema(description = "录入时间排序:0-升序 1-降序,默认1")
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(仅限 Top 3)

    1. 【规范与可维护性】弃用 java.util.Date,推荐使用 java.time.LocalDateTime

    • 问题描述:在所有的 DTO、请求参数和 Entity 中,新增的时间字段均使用了 java.util.Date。根据《阿里巴巴 Java 开发手册》以及 Java 8+ 最佳实践,java.util.Date 存在线程不安全、设计存在缺陷(如月份从0开始)等问题。
    • 优化建议:将所有新增的时间字段类型更改为 java.time.LocalDateTime。同时配合 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 依然可以完美完成前后端的序列化与反序列化交互。

    2. 【架构与可维护性】实体类(Entity)职责不单一,混入了表现层注解

    • 问题描述:在实体类 CluesInfo.java 中,新增的字段同时使用了 @TableField(MyBatis-Plus 数据库映射)、@JsonFormat(Jackson 序列化)和 @Schema(Swagger/SpringDoc 接口文档)注解。
    • 优化建议:实体类(Entity)应当保持纯粹,仅用于与数据库的映射。接口文档说明(@Schema)和序列化格式控制(@JsonFormat)应该只在表现层的 DTO/VO 中使用。建议移除 CluesInfo.java 中的 @JsonFormat 和 @Schema 注解,严格遵守分层架构设计规范。

    3. 【健壮性】时间范围查询参数缺少逻辑校验

    • 问题描述:在 CluesWebPageReq.java 中,新增了 latestFollowTimeStart 和 latestFollowTimeEnd 用于范围查询,但缺少对这两个时间先后顺序的校验支持。
    • 优化建议:如果前端或恶意请求传入 Start > End 的参数,可能会导致数据库执行无效查询(全表扫描或索引失效)或返回异常数据。建议在 Controller 层使用自定义校验注解(如 @TimeRange),或在 Service 层明确增加 if (start.after(end)) 的防御性编程校验,并抛出友好的业务异常。

    二、评分明细

    评审项 满分 得分 扣分原因/备注
    1. 功能实现与健壮性 40 38 业务功能添加完整,但查询参数缺少时间范围(开始<=结束)的健壮性校验。
    2. 安全性与潜在风险 30 30 提供的 DTO 和 Entity 代码中未见明显的安全漏洞(如 SQL 注入或越权风险)。
    3. 最佳实践与可维护性 20 15 使用了过时的 java.util.Date,且 Entity 类混入了 Swagger 和 Jackson 注解,违反了单一职责和阿里规约。
    4. 性能与资源利用 5 5 纯 POJO 字段变更,无明显性能损耗(注:需确保数据库中 latest_follow_time 已建立合适的索引以支撑范围查询)。
    5. 提交信息质量 5 5 Commit message 规范清晰,采用了 Conventional Commits 格式,详细说明了变更的文件和业务目的。

    总分:93分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!