Commit a30d42b6 by 崔彦峰

feat(clues): 添加线索详情查询功能

- 新增 CluesDetailReq 请求类用于线索详情查询
- 新增 CluesDetailResp 响应类定义线索详情数据结构
- 在 CluesRemote 接口中添加 detail 方法支持线索详情查询
- 在 CluesController 中实现 detail 接口方法
- 在 CluesInfoMapper 中添加 detail 查询方法
- 配置 CluesInfoMapper.xml 中的 detail SQL 查询语句
- 修改线索跟进状态枚举值为 0-正常 1-临期 2-已超期
- 更新 CluesPageQuery 中的跟进状态注释说明
- 在 CluesInfoService 中实现线索详情查询和状态填充逻辑
- 在 PAD 和 WEB 门面层分别添加线索详情查询接口
- 移除 CluesPageResp 中的跟进状态描述字段
1 parent ff25660f
package com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 线索详情响应。
*/
@Data
@Schema(description = "线索详情响应")
public class CluesDetailResp implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键ID")
private Integer id;
@Schema(description = "线索编号")
private String cluesNo;
@Schema(description = "线索状态:1-待跟进 2-跟进中 3-暂败 4-成功收车")
private Integer cluesStatus;
@Schema(description = "车主名称")
private String carOwnerName;
@Schema(description = "车主电话")
private String carOwnerPhone;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "线索录入时间")
private Date enterTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "线索下一次跟进时间")
private Date nextFollowTime;
@Schema(description = "客户意向等级:A、B、C、D、O、H")
private String customerIntentLevel;
@Schema(description = "车辆品牌名称")
private String carBrand;
@Schema(description = "子品牌ID")
private Integer carChildsBrandId;
@Schema(description = "子品牌名称")
private String carChildsBrandName;
@Schema(description = "车系ID")
private Integer carSeriesId;
@Schema(description = "车系名称")
private String carSeriesName;
@Schema(description = "车型ID")
private Integer carTypeId;
@Schema(description = "车型名称")
private String carTypeName;
@Schema(description = "销售用户ID(4S店)")
private String sellerUserId;
@Schema(description = "销售姓名(4S店)")
private String sellerName;
@Schema(description = "销售商户号(4S店)")
private Integer sellerMerchantId;
@Schema(description = "销售商户名称(4S店)")
private String sellerMerchantName;
@Schema(description = "转化用户ID(园区店)")
private String conversionUserId;
@Schema(description = "转化姓名(园区店)")
private String conversionName;
@Schema(description = "转化商户号(园区店)")
private Integer conversionMerchantId;
@Schema(description = "转化商户名称(园区店)")
private String conversionMerchantName;
@Schema(description = "备注说明")
private String remark;
@Schema(description = "创建人")
private String createdBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Schema(description = "创建时间")
private Date createdDate;
@Schema(description = "跟进状态:0-正常 1-临期 2-已超期")
private Integer followTimeStatus;
}
...@@ -59,12 +59,9 @@ public class CluesPageResp implements Serializable { ...@@ -59,12 +59,9 @@ public class CluesPageResp implements Serializable {
@Schema(description = "线索状态:1-待跟进 2-跟进中 3-暂败 4-成功收车") @Schema(description = "线索状态:1-待跟进 2-跟进中 3-暂败 4-成功收车")
private Integer cluesStatus; private Integer cluesStatus;
@Schema(description = "跟进状态:1-正常 2-临期 3-已超期") @Schema(description = "跟进状态:0-正常 1-临期 2-已超期")
private Integer followTimeStatus; private Integer followTimeStatus;
@Schema(description = "跟进状态描述:正常/临期/已超期")
private String followTimeStatusDesc;
@Schema(description = "下一次跟进时间") @Schema(description = "下一次跟进时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date nextFollowTime; private Date nextFollowTime;
......
...@@ -3,11 +3,13 @@ package com.gsc4cloud.gsc.vpc.api.feign.pad.clues; ...@@ -3,11 +3,13 @@ package com.gsc4cloud.gsc.vpc.api.feign.pad.clues;
import com.gsc4cloud.gsc.common.core.constant.ServiceNameConstants; import com.gsc4cloud.gsc.common.core.constant.ServiceNameConstants;
import com.gsc4cloud.gsc.common.core.util.R; import com.gsc4cloud.gsc.common.core.util.R;
import com.gsc4cloud.gsc.vpc.api.req.pad.clues.AddCluesReq; import com.gsc4cloud.gsc.vpc.api.req.pad.clues.AddCluesReq;
import com.gsc4cloud.gsc.vpc.api.req.pad.clues.CluesDetailReq;
import com.gsc4cloud.gsc.vpc.api.req.pad.clues.CluesPadPageReq; import com.gsc4cloud.gsc.vpc.api.req.pad.clues.CluesPadPageReq;
import com.gsc4cloud.gsc.vpc.api.req.pad.clues.CluesStatusCountReq; import com.gsc4cloud.gsc.vpc.api.req.pad.clues.CluesStatusCountReq;
import com.gsc4cloud.gsc.vpc.api.req.web.clues.CluesWebPageReq; import com.gsc4cloud.gsc.vpc.api.req.web.clues.CluesWebPageReq;
import com.gsc4cloud.gsc.vpc.api.req.PageRequest; import com.gsc4cloud.gsc.vpc.api.req.PageRequest;
import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.AddCluesResp; import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.AddCluesResp;
import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.CluesDetailResp;
import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.CluesPageResp; import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.CluesPageResp;
import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.CluesStatusCountResp; import com.gsc4cloud.gsc.vpc.api.dto.pad.resdto.clues.CluesStatusCountResp;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -28,6 +30,12 @@ public interface CluesRemote { ...@@ -28,6 +30,12 @@ public interface CluesRemote {
R<AddCluesResp> addClues(@RequestBody AddCluesReq req); R<AddCluesResp> addClues(@RequestBody AddCluesReq req);
/** /**
* PAD/Web端线索详情
*/
@PostMapping("/clues/detail")
R<CluesDetailResp> detail(@RequestBody CluesDetailReq req);
/**
* PAD端线索分页列表 * PAD端线索分页列表
*/ */
@PostMapping("/clues/padPage") @PostMapping("/clues/padPage")
......
package com.gsc4cloud.gsc.vpc.api.req.pad.clues;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
/**
* 线索详情查询请求。
*/
@Data
@Schema(description = "线索详情查询请求")
public class CluesDetailReq implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "线索主键ID不能为空")
@Schema(description = "线索主键ID")
private Integer id;
}
...@@ -24,10 +24,10 @@ public class CluesWebPageReq implements Serializable { ...@@ -24,10 +24,10 @@ public class CluesWebPageReq implements Serializable {
@Schema(description = "客户意向等级多选精准搜索:A/B/C/D/O/H") @Schema(description = "客户意向等级多选精准搜索:A/B/C/D/O/H")
private List<String> customerIntentLevelList; private List<String> customerIntentLevelList;
@Schema(description = "线索跟进状态多选精准搜索:1-临期 2-超期") @Schema(description = "线索跟进状态多选精准搜索:1-临期 2-已超期")
private List<Integer> followTimeStatusList; private List<Integer> followTimeStatusList;
@Schema(description = "线索跟进状态单选兼容字段:1-临期 2-超期") @Schema(description = "线索跟进状态单选兼容字段:1-临期 2-已超期")
private Integer followTimeStatus; private Integer followTimeStatus;
@Schema(description = "销售(4S店)商户ID多选精准搜索") @Schema(description = "销售(4S店)商户ID多选精准搜索")
......
  • @wangxw1
    commented
    Master

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

    1. 接口设计不符合 RESTful 规范(最佳实践与可维护性)

    • 问题描述:在 CluesRemote 中,查询线索详情的接口使用了 @PostMapping("/clues/detail"),并且通过 @RequestBody CluesDetailReq 包装了单一的 id 参数。根据 RESTful 规范,单纯的通过 ID 获取详情属于幂等的读取操作,不应使用 POST 请求,也不需要专门为此封装一个只包含单个属性的 Request 对象。
    • 优化建议:建议改为 GET 请求,并使用 @PathVariable 或 @RequestParam 传递 ID。 java // 建议修改为: @GetMapping("/clues/detail/{id}") R<CluesDetailResp> detail(@PathVariable("id") Integer id); 同时可删除冗余的 CluesDetailReq.java 类,减少系统类的数量,提升可维护性。

    2. 违反阿里巴巴 Java 开发手册关于日期类型的规约(最佳实践与可维护性)

    • 问题描述:在 CluesDetailResp 和 CluesPageResp 中,时间字段(如 enterTime, nextFollowTime)使用了 java.util.Date。阿里巴巴 Java 开发规范(泰山版/嵩山版)明确强制规定:“不允许在程序任何地方中使用 java.sql.Date、java.sql.Time、java.sql.Timestamp,而如果是 JDK8 的应用,可以使用 Instant 代替 Date,LocalDateTime 代替 Calendar,DateTimeFormatter 代替 SimpleDateFormat”。java.util.Date 存在线程不安全、设计缺陷等问题。
    • 优化建议:将所有的 java.util.Date 替换为 java.time.LocalDateTime。 java @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime enterTime;

    3. API 响应字段移除与状态值变更导致向下兼容性风险(功能健壮性)

    • 问题描述:在 CluesPageResp.java 中,移除了 followTimeStatusDesc 字段,并且将 followTimeStatus 的枚举值从 1-正常 2-临期 3-已超期 修改为了 0-正常 1-临期 2-已超期。这是一个典型的 Breaking Change(破坏性变更)。如果前端或第三方调用方已经在线上依赖了原有的状态值映射或描述字段,直接发布此代码会导致线上功能异常(如状态显示错误、前端取不到字段报错)。
    • 优化建议:
      • 如果必须修改状态值,需确保前后端代码强绑定同步发布,并排查历史数据的兼容性问题。
      • 对于移除的字段,规范的做法是保留原字段并标记 @Deprecated,或者确认该字段在任何调用端(Pad/Web)均未被使用后才能安全删除。

    二、评分明细

    • 功能实现的正确性与健壮性(35/40分):基础查询功能结构完整。扣分点在于对现有响应类(CluesPageResp)的破坏性修改(状态值变更及字段移除),缺乏对向前兼容性的考虑,存在导致调用方报错的风险。
    • 安全性与潜在风险(26/30分):整体无明显 SQL 注入或越权风险(需结合 Service 层看)。扣分点在于 CluesDetailResp 中包含了敏感信息(如 carOwnerPhone 车主电话),在 DTO 层面未看到脱敏处理(如 @Desensitize 注解),建议在网关或序列化层确保对敏感 PII 数据进行脱敏。
    • 最佳实践与可维护性(12/20分):扣分点主要集中在违背 RESTful 接口设计原则(POST 查详情、过度封装单字段 Req 类)以及违背阿里巴巴 Java 开发手册关于日期类型(强推 LocalDateTime 禁用 Date)的规约。另外,状态值(如 0, 1, 2)大量使用魔法值注释,建议抽取为 Enum 枚举类。
    • 性能与资源利用(5/5分):分页与详情查询为常规操作,DTO 定义合理,无明显的内存泄漏或性能瓶颈风险。
    • 提交信息质量(5/5分):Commit Message 非常优秀,严格遵循了 Angular/Conventional Commits 规范,清晰列出了各项变更的具体内容,便于 Code Review 和历史追溯。

    总分:83分

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