Commit a6ced300 by 章家宝

feat:去掉审批通过之后指定门店

1 parent 74f6c30d
...@@ -8,7 +8,6 @@ import lombok.ToString; ...@@ -8,7 +8,6 @@ import lombok.ToString;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 审批专项带教申请请求DTO * 审批专项带教申请请求DTO
...@@ -38,12 +37,6 @@ public class ApproveSpecialTaskDTO implements Serializable { ...@@ -38,12 +37,6 @@ public class ApproveSpecialTaskDTO implements Serializable {
@ApiModelProperty(value = "指定督导姓名(通过时必填)") @ApiModelProperty(value = "指定督导姓名(通过时必填)")
private String assignedSupervisorName; private String assignedSupervisorName;
@ApiModelProperty(value = "指定门店ID(通过时必填)")
private Integer assignedMerchantId;
@ApiModelProperty(value = "指定门店名称(通过时必填)")
private String assignedMerchantName;
@ApiModelProperty(value = "带教场景编码(通过时选填,字典:teaching_scene)") @ApiModelProperty(value = "带教场景编码(通过时选填,字典:teaching_scene)")
private String teachingSceneCode; private String teachingSceneCode;
......
...@@ -3,9 +3,9 @@ package cn.com.glsx.dj.supervisor.model; ...@@ -3,9 +3,9 @@ package cn.com.glsx.dj.supervisor.model;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*;
/** /**
* 专项带教审批表 * 专项带教审批表
...@@ -141,18 +141,6 @@ public class SupervisorSpecialCoachApproval implements Serializable { ...@@ -141,18 +141,6 @@ public class SupervisorSpecialCoachApproval implements Serializable {
private String assignedSupervisorName; private String assignedSupervisorName;
/** /**
* 指定门店ID
*/
@Column(name = "assigned_merchant_id")
private Integer assignedMerchantId;
/**
* 指定门店名称
*/
@Column(name = "assigned_merchant_name")
private String assignedMerchantName;
/**
* 任务中心task.task_id * 任务中心task.task_id
*/ */
@Column(name = "task_center_id") @Column(name = "task_center_id")
......
...@@ -147,9 +147,6 @@ public class SupervisorSpecialCoachApprovalService { ...@@ -147,9 +147,6 @@ public class SupervisorSpecialCoachApprovalService {
if (StringUtils.isBlank(request.getAssignedSupervisorPhone())) { if (StringUtils.isBlank(request.getAssignedSupervisorPhone())) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "指定督导手机号不能为空"); throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "指定督导手机号不能为空");
} }
if (request.getAssignedMerchantId() == null) {
throw new RpcServiceException(DefaultErrorEnum.PARAMETER_NULL, "指定门店ID不能为空");
}
} }
// 校验执行人记录是否存在(审批通过和驳回都需要) // 校验执行人记录是否存在(审批通过和驳回都需要)
...@@ -188,8 +185,6 @@ public class SupervisorSpecialCoachApprovalService { ...@@ -188,8 +185,6 @@ public class SupervisorSpecialCoachApprovalService {
if (ApprovalStatusEnum.PASSED.getCode().equals(request.getApprovalStatus())) { if (ApprovalStatusEnum.PASSED.getCode().equals(request.getApprovalStatus())) {
update.setAssignedSupervisorPhone(request.getAssignedSupervisorPhone()); update.setAssignedSupervisorPhone(request.getAssignedSupervisorPhone());
update.setAssignedSupervisorName(request.getAssignedSupervisorName()); update.setAssignedSupervisorName(request.getAssignedSupervisorName());
update.setAssignedMerchantId(request.getAssignedMerchantId());
update.setAssignedMerchantName(request.getAssignedMerchantName());
update.setTeachingSceneCode(request.getTeachingSceneCode()); update.setTeachingSceneCode(request.getTeachingSceneCode());
update.setTeachingSceneName(request.getTeachingSceneName()); update.setTeachingSceneName(request.getTeachingSceneName());
update.setTeachingMethodCode(request.getTeachingMethodCode()); update.setTeachingMethodCode(request.getTeachingMethodCode());
...@@ -652,9 +647,7 @@ public class SupervisorSpecialCoachApprovalService { ...@@ -652,9 +647,7 @@ public class SupervisorSpecialCoachApprovalService {
pushRequest.setBizCode(bizCode); pushRequest.setBizCode(bizCode);
// 门店ID // 门店ID
Integer merchantId = request.getAssignedMerchantId() != null pushRequest.setMerchantId(String.valueOf(approval.getMerchantId()));
? request.getAssignedMerchantId() : approval.getMerchantId();
pushRequest.setMerchantId(merchantId != null ? String.valueOf(merchantId) : null);
log.info("推送群消息参数,groupName={}, content={}, bizCode={}, merchantId={}", log.info("推送群消息参数,groupName={}, content={}, bizCode={}, merchantId={}",
pushRequest.getGroupName(), pushRequest.getContent(), pushRequest.getBizCode(), pushRequest.getMerchantId()); pushRequest.getGroupName(), pushRequest.getContent(), pushRequest.getBizCode(), pushRequest.getMerchantId());
...@@ -674,16 +667,6 @@ public class SupervisorSpecialCoachApprovalService { ...@@ -674,16 +667,6 @@ public class SupervisorSpecialCoachApprovalService {
*/ */
private String buildTaskTitle(SupervisorSpecialCoachApproval approval, ApproveSpecialTaskDTO request) { private String buildTaskTitle(SupervisorSpecialCoachApproval approval, ApproveSpecialTaskDTO request) {
StringBuilder title = new StringBuilder("专项带教任务"); StringBuilder title = new StringBuilder("专项带教任务");
if (StringUtils.isNotBlank(request.getAssignedMerchantName())) {
title.append(" - ").append(request.getAssignedMerchantName());
} else if (StringUtils.isNotBlank(approval.getMerchantName())) {
title.append(" - ").append(approval.getMerchantName());
}
if (StringUtils.isNotBlank(request.getTeachingTopicName())) {
title.append(" - ").append(request.getTeachingTopicName());
} else if (StringUtils.isNotBlank(approval.getTeachingTopicName())) {
title.append(" - ").append(approval.getTeachingTopicName());
}
return title.toString(); return title.toString();
} }
......
...@@ -284,7 +284,7 @@ public class SupervisorSpecialTaskService { ...@@ -284,7 +284,7 @@ public class SupervisorSpecialTaskService {
* @param request 专项任务请求 * @param request 专项任务请求
* @param taskId 专项任务ID * @param taskId 专项任务ID
*/ */
private void createCollaborativeStrategy(SubmitSpecialTaskDTO request, Long taskId) { public void createCollaborativeStrategy(SubmitSpecialTaskDTO request, Long taskId) {
try { try {
// 1. 映射策略类型 // 1. 映射策略类型
Integer strategyType = mapBizTypeToStrategyType(request.getBizType()); Integer strategyType = mapBizTypeToStrategyType(request.getBizType());
...@@ -307,6 +307,7 @@ public class SupervisorSpecialTaskService { ...@@ -307,6 +307,7 @@ public class SupervisorSpecialTaskService {
strategyInfo.setCreatedUUid(request.getSupervisorUuid()); strategyInfo.setCreatedUUid(request.getSupervisorUuid());
strategyInfo.setDataSource(2); strategyInfo.setDataSource(2);
strategyInfo.setDataSourceId(taskId); strategyInfo.setDataSourceId(taskId);
strategyInfo.setCreatedBy(request.getSupervisorName());
// 4. 构建人员列表(问题人员 + 区域运营) // 4. 构建人员列表(问题人员 + 区域运营)
List<StrategyStaffRel> staffList = new ArrayList<>(); List<StrategyStaffRel> staffList = new ArrayList<>();
...@@ -337,6 +338,7 @@ public class SupervisorSpecialTaskService { ...@@ -337,6 +338,7 @@ public class SupervisorSpecialTaskService {
} }
} }
strategyInfo.setStaffList(staffList); strategyInfo.setStaffList(staffList);
log.error("请求参数 {}", strategyInfo);
// 6. 调用远程接口 // 6. 调用远程接口
RpcResponse<Integer> response = strategyInfoRemote.create(strategyInfo); RpcResponse<Integer> response = strategyInfoRemote.create(strategyInfo);
if (response == null || !response.isSuccess()) { if (response == null || !response.isSuccess()) {
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
<result column="reject_reason" property="rejectReason" jdbcType="VARCHAR"/> <result column="reject_reason" property="rejectReason" jdbcType="VARCHAR"/>
<result column="assigned_supervisor_phone" property="assignedSupervisorPhone" jdbcType="VARCHAR"/> <result column="assigned_supervisor_phone" property="assignedSupervisorPhone" jdbcType="VARCHAR"/>
<result column="assigned_supervisor_name" property="assignedSupervisorName" jdbcType="VARCHAR"/> <result column="assigned_supervisor_name" property="assignedSupervisorName" jdbcType="VARCHAR"/>
<result column="assigned_merchant_id" property="assignedMerchantId" jdbcType="INTEGER"/>
<result column="assigned_merchant_name" property="assignedMerchantName" jdbcType="VARCHAR"/>
<result column="task_center_id" property="taskCenterId" jdbcType="BIGINT"/> <result column="task_center_id" property="taskCenterId" jdbcType="BIGINT"/>
<result column="teaching_scene_code" property="teachingSceneCode" jdbcType="VARCHAR"/> <result column="teaching_scene_code" property="teachingSceneCode" jdbcType="VARCHAR"/>
<result column="teaching_scene_name" property="teachingSceneName" jdbcType="VARCHAR"/> <result column="teaching_scene_name" property="teachingSceneName" jdbcType="VARCHAR"/>
...@@ -72,7 +70,7 @@ ...@@ -72,7 +70,7 @@
id, biz_type, category_name, merchant_id, merchant_name, business_type, business_type_name, id, biz_type, category_name, merchant_id, merchant_name, business_type, business_type_name,
teaching_staff_phones, teaching_staff_names, supervisor_phones, supervisor_names, apply_description, teaching_staff_phones, teaching_staff_names, supervisor_phones, supervisor_names, apply_description,
approval_status, approval_time, approver_id, approver_name, approver_phone, reject_reason, approval_status, approval_time, approver_id, approver_name, approver_phone, reject_reason,
assigned_supervisor_phone, assigned_supervisor_name, assigned_merchant_id, assigned_merchant_name, assigned_supervisor_phone, assigned_supervisor_name,
task_center_id, teaching_scene_code, teaching_scene_name, teaching_method_code, teaching_method_name, task_center_id, teaching_scene_code, teaching_scene_name, teaching_method_code, teaching_method_name,
teaching_topic_code, teaching_topic_name, teaching_time, source, source_id, teaching_topic_code, teaching_topic_name, teaching_time, source, source_id,
created_phone, created_uuid, created_by, create_time, updated_by, update_time, deleted_flag created_phone, created_uuid, created_by, create_time, updated_by, update_time, deleted_flag
...@@ -100,8 +98,6 @@ ...@@ -100,8 +98,6 @@
<if test="rejectReason != null">reject_reason,</if> <if test="rejectReason != null">reject_reason,</if>
<if test="assignedSupervisorPhone != null">assigned_supervisor_phone,</if> <if test="assignedSupervisorPhone != null">assigned_supervisor_phone,</if>
<if test="assignedSupervisorName != null">assigned_supervisor_name,</if> <if test="assignedSupervisorName != null">assigned_supervisor_name,</if>
<if test="assignedMerchantId != null">assigned_merchant_id,</if>
<if test="assignedMerchantName != null">assigned_merchant_name,</if>
<if test="taskCenterId != null">task_center_id,</if> <if test="taskCenterId != null">task_center_id,</if>
<if test="teachingSceneCode != null">teaching_scene_code,</if> <if test="teachingSceneCode != null">teaching_scene_code,</if>
<if test="teachingSceneName != null">teaching_scene_name,</if> <if test="teachingSceneName != null">teaching_scene_name,</if>
...@@ -140,8 +136,6 @@ ...@@ -140,8 +136,6 @@
<if test="rejectReason != null">#{rejectReason},</if> <if test="rejectReason != null">#{rejectReason},</if>
<if test="assignedSupervisorPhone != null">#{assignedSupervisorPhone},</if> <if test="assignedSupervisorPhone != null">#{assignedSupervisorPhone},</if>
<if test="assignedSupervisorName != null">#{assignedSupervisorName},</if> <if test="assignedSupervisorName != null">#{assignedSupervisorName},</if>
<if test="assignedMerchantId != null">#{assignedMerchantId},</if>
<if test="assignedMerchantName != null">#{assignedMerchantName},</if>
<if test="taskCenterId != null">#{taskCenterId},</if> <if test="taskCenterId != null">#{taskCenterId},</if>
<if test="teachingSceneCode != null">#{teachingSceneCode},</if> <if test="teachingSceneCode != null">#{teachingSceneCode},</if>
<if test="teachingSceneName != null">#{teachingSceneName},</if> <if test="teachingSceneName != null">#{teachingSceneName},</if>
......
  • @wangxw1
    commented
    Master

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

    1. 违反重要规则:Dubbo RPC 接口请求参数发生破坏性变更

    • 问题描述:在 rpc-dj-supervisor-api 模块的 ApproveSpecialTaskDTO 中,直接删除了 assignedMerchantId 和 assignedMerchantName 字段。
    • 影响分析:触发了“dubbo服务提供者Remote接口中的已有请求参数变更视为危险实现”的红线规则。 API 包是提供给消费端使用的,直接删除字段属于破坏性变更(Breaking Change)。如果消费端未同步升级 API 包或其代码中仍存在对该字段的引用,会导致消费端编译失败、反序列化异常或 RPC 调用报错,引发线上生产事故。
    • 优化建议:不要直接删除字段,而是使用 @Deprecated 注解标记废弃,并在业务逻辑中不再使用该字段。 ```java @Deprecated @ApiModelProperty(value = "指定门店ID(已废弃)") private Integer assignedMerchantId;

    @Deprecated @ApiModelProperty(value = "指定门店名称(已废弃)") private String assignedMerchantName;

    
    **2. 业务逻辑过度删除(疑似功能 Bug)**
    - **问题描述**:在 `SupervisorSpecialCoachApprovalService.java` 的 `buildTaskTitle` 方法中,除了删除与 `assignedMerchantName` 相关的逻辑外,还将原有的 `approval.getMerchantName()` 以及 `TeachingTopicName`(带教主题)的拼接逻辑一并删除了。
    - **影响分析**:根据提交信息,本次需求仅为“去掉审批通过之后指定门店”。但过度删除导致生成的任务标题仅剩下“专项带教任务”几个字,丢失了原有的“原门店名称”和“带教主题”等重要上下文信息,会严重影响前端展示和用户的业务辨识度。
    - **优化建议**:恢复非“指定门店”相关的标题拼接逻辑。
      ```java
      private String buildTaskTitle(SupervisorSpecialCoachApproval approval, ApproveSpecialTaskDTO request) {
          StringBuilder title = new StringBuilder("专项带教任务");
          // 恢复原门店名称拼接
          if (StringUtils.isNotBlank(approval.getMerchantName())) {
              title.append(" - ").append(approval.getMerchantName());
          }
          // 恢复带教主题拼接
          if (StringUtils.isNotBlank(request.getTeachingTopicName())) {
              title.append(" - ").append(request.getTeachingTopicName());
          } else if (StringUtils.isNotBlank(approval.getTeachingTopicName())) {
              title.append(" - ").append(approval.getTeachingTopicName());
          }
          return title.toString();
      }
    

    3. 日志级别使用不当

    • 问题描述:在 SupervisorSpecialTaskService.java 的 createCollaborativeStrategy 方法中,使用了 log.error("请求参数 {}", strategyInfo); 来打印正常的业务请求参数。
    • 影响分析:使用 error 级别打印常规参数是典型的工程反模式。这不仅会污染错误日志文件,还会触发线上日志监控系统(如 ELK、Sentry 等)的误报警,增加运维排查负担。
    • 优化建议:将日志级别修改为 info 或 debug。 java log.info("创建协同策略请求参数: {}", strategyInfo);

    二、评分明细

    1. 功能实现的正确性与健壮性(25/40分)

      • 扣分理由:触发了 Dubbo 接口参数变更的危险实现红线(-10分);在清理代码时误删了任务标题拼接的核心业务逻辑,导致功能退化(-5分)。
    2. 安全性与潜在风险(30/30分)

      • 得分理由:代码中未发现 SQL 注入、越权、XSS 等典型的安全漏洞,MyBatis 的 XML 修改也符合规范,无子查询。
    3. 最佳实践与可维护性(15/20分)

      • 扣分理由:滥用 log.error 打印正常业务参数,不符合日志规范(-3分);createCollaborativeStrategy 方法无故从 private 改为 public,破坏了类的封装性(-2分)。
    4. 性能与资源利用(5/5分)

      • 得分理由:未发现明显的性能瓶颈,无循环查库或内存泄漏风险。
    5. 提交信息质量(3/5分)

      • 扣分理由:Commit 信息 feat:去掉审批通过之后指定门店 阐述了主要目的,但未能涵盖代码中添加 createdBy 以及修改协同策略方法可见性等其他变更,缺乏完整性(-2分)。

    总分:78分

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