Commit 7937d742 by 王璐琦

feat(daily-report): 废弃旧模板和字段,新增日报字段支持

- 注释并废弃了驻店日报(模板类型1)相关逻辑及接口
- 在接口请求类中标注模板类型字段为废弃并调整备注
- 更新pom版本号至5.8.5-SNAPSHOT
- DailyReportFieldEnum中大量旧字段标注为@Deprecated并新增新的日报字段
- 新增接口listDailyReportTemplate,标记为@Deprecated,提示替代使用
- 调整部分API模型中的员工UUID字段为非必填
- 保持旧接口和逻辑兼容,逐步过渡到新字段体系
1 parent 64bda97d
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-daily-report-api</artifactId> <artifactId>rpc-dj-daily-report-api</artifactId>
<version>5.8.4-SNAPSHOT</version> <version>5.8.5-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
......
...@@ -131,11 +131,12 @@ public class DailyReportRecordController { ...@@ -131,11 +131,12 @@ public class DailyReportRecordController {
if (Objects.equals(DailyReportTemplateTypeEnum.MERCHANT_DAILY_REPORT.getValue(), dailyReportRecordDTO.getTemplateType())) { if (Objects.equals(DailyReportTemplateTypeEnum.MERCHANT_DAILY_REPORT.getValue(), dailyReportRecordDTO.getTemplateType())) {
dailyReportRecordDTO.setStaffUuid(null); dailyReportRecordDTO.setStaffUuid(null);
} }
dailyReportRecordDTO.setReportStatus(DailyReportReportStatusEnum.SUBMITTED.getValue()); //dailyReportRecordDTO.setReportStatus(DailyReportReportStatusEnum.SUBMITTED.getValue());
RpcResponse<List<String>> response = dailyReportRecordRemote.listDailyReportWeekly(dailyReportRecordDTO); RpcResponse<List<String>> response = dailyReportRecordRemote.listDailyReportWeekly(dailyReportRecordDTO);
return CommonUtil.convertRopResponse(response); return CommonUtil.convertRopResponse(response);
} }
@Deprecated
@ApiOperation("查询当前有效的表单模板") @ApiOperation("查询当前有效的表单模板")
@ServiceMethod(method = "dj.api.smartcarlife.dailyReport.template.list", needInSession = NeedInSessionType.NO) @ServiceMethod(method = "dj.api.smartcarlife.dailyReport.template.list", needInSession = NeedInSessionType.NO)
public RopResponse<List<DailyReportTemplateResponse>> listDailyReportTemplate(DailyReportTemplateListRequest request) { public RopResponse<List<DailyReportTemplateResponse>> listDailyReportTemplate(DailyReportTemplateListRequest request) {
......
...@@ -58,7 +58,7 @@ public class DynamicDailyReportSaveRequest extends AbstractRopRequest { ...@@ -58,7 +58,7 @@ public class DynamicDailyReportSaveRequest extends AbstractRopRequest {
private Byte dailyReportSource; private Byte dailyReportSource;
@NotNull @NotNull
@ApiModelProperty(name = "templateType", notes = "模板类型(1:驻店日报,2:门店日报,3:洽谈明细)",required=true) @ApiModelProperty(name = "templateType", notes = "模板类型(1:驻店日报(废弃),2:门店日报,3:洽谈明细(废弃))",required=true)
private Byte templateType; private Byte templateType;
@ApiModelProperty(name = "submissionStatus", notes = "上报状态(1:已上报,2:未上报)") @ApiModelProperty(name = "submissionStatus", notes = "上报状态(1:已上报,2:未上报)")
......
...@@ -32,6 +32,6 @@ public class GetDailyReportDetailRequest extends AbstractRopRequest { ...@@ -32,6 +32,6 @@ public class GetDailyReportDetailRequest extends AbstractRopRequest {
private String reportDate; private String reportDate;
@NotNull @NotNull
@ApiModelProperty(name = "templateType", notes = "模板类型:1=驻店日报,2=门店日报,3=洽谈明细",required=true) @ApiModelProperty(name = "templateType", notes = "模板类型:1=驻店日报(废弃),2=门店日报,3=洽谈明细(废弃)",required=true)
private Byte templateType; private Byte templateType;
} }
...@@ -20,7 +20,7 @@ public class GetDailyReportListRequest extends AbstractRopRequest { ...@@ -20,7 +20,7 @@ public class GetDailyReportListRequest extends AbstractRopRequest {
@ApiModelProperty(name = "merchantId", notes = "4s店商户号",required=true) @ApiModelProperty(name = "merchantId", notes = "4s店商户号",required=true)
private Integer merchantId; private Integer merchantId;
@ApiModelProperty(name = "staffUuid", notes = "员工uuid",required=true) @ApiModelProperty(name = "staffUuid", notes = "员工uuid")
private String staffUuid; private String staffUuid;
@NotNull @NotNull
...@@ -28,7 +28,7 @@ public class GetDailyReportListRequest extends AbstractRopRequest { ...@@ -28,7 +28,7 @@ public class GetDailyReportListRequest extends AbstractRopRequest {
private Byte sceneType; private Byte sceneType;
@NotNull @NotNull
@ApiModelProperty(name = "templateType", notes = "模板类型:1-驻店日报,2-门店日报,3-洽谈明细",required=true) @ApiModelProperty(name = "templateType", notes = "模板类型:1-驻店日报(废弃),2-门店日报,3-洽谈明细(废弃)",required=true)
private Byte templateType; private Byte templateType;
@NotNull @NotNull
......
  • @wangxw1
    commented
    Master

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

    1. 违背规范:直接注释代码而非删除(可维护性)

    • 位置:DailyReportRecordController.java 第 134 行 java //dailyReportRecordDTO.setReportStatus(DailyReportReportStatusEnum.SUBMITTED.getValue());
    • 问题:根据《阿里巴巴 Java 开发手册》编程规约,废弃或不再使用的代码应直接删除,而不是注释掉。代码仓库(Git)已经保存了历史版本,保留注释代码会干扰代码阅读,增加后续维护者的认知负担,且无法明确该代码未来是否还需要恢复。
    • 建议:直接删除该行注释代码。如果该逻辑变更是因为业务调整,可以在提交信息(Commit Message)中说明,而不是把代码留在源码里。

    2. 潜在缺陷:状态字段缺失可能导致下游 RPC 异常(功能正确性)

    • 位置:DailyReportRecordController.java 第 134-135 行
    • 问题:将 setReportStatus 注释掉后,dailyReportRecordDTO 中的 reportStatus 字段可能会透传为 null。紧接着代码调用了 RPC 接口 dailyReportRecordRemote.listDailyReportWeekly(dailyReportRecordDTO)。如果下游 RPC 服务端没有对 reportStatus 为 null 的情况进行防御性编程或默认值处理,极易引发 NullPointerException 或导致 SQL 查询条件失效(例如全表扫描)。
    • 建议:确认下游 RPC 接口 listDailyReportWeekly 是否兼容 reportStatus 为 null 的情况。如果下游需要默认状态,应在当前侧显式赋值,或者在下游做好判空处理。

    3. 违背规范:@Deprecated 注解缺少 Javadoc 详细说明(最佳实践)

    • 位置:DailyReportRecordController.java 第 137 行 java @Deprecated @ApiOperation("查询当前有效的表单模板")
    • 问题:根据《阿里巴巴 Java 开发手册》规约,若接口、类或方法过时,必须加 @Deprecated 注解,并同时加 Javadoc 的 @deprecated 标签,在注释中明确说明该接口被废弃的原因以及替代的新接口/新方法是什么。当前代码仅添加了注解,调用方无法直接从代码层面得知应该迁移到哪个新接口。
    • 建议:补充 Javadoc 注释,例如: java /** * 查询当前有效的表单模板 * @deprecated 该接口因模板升级已废弃,请使用新的接口 {@link xxxController#newMethod} 替代 */ @Deprecated

    二、评分明细

    1. 功能实现的正确性与健壮性(40分):34分
      • 扣分项:注释掉状态赋值逻辑,未见对下游 RPC 调用的兼容性说明,存在透传 null 导致下游异常的风险;将 staffUuid 改为非必填,需确保底层查询逻辑已做好判空兼容。
    2. 安全性与潜在风险(30分):30分
      • 未发现明显的 SQL 注入、越权等安全漏洞。
    3. 最佳实践与可维护性(20分):14分
      • 扣分项:违反阿里规范保留注释掉的死代码(-3分);废弃接口未提供 @deprecated 文档说明替代方案(-3分)。
    4. 性能与资源利用(5分):5分
      • 无明显的性能瓶颈或资源浪费。
    5. 提交信息质量(5分):5分
      • 提交信息采用了 feat(scope): subject 的规范格式,且详细列出了变更点,质量较高。

    总分:88分

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