Commit 96f5f43b by 谢海旭

策略中心:查询区域督导接口调整、新建单个策略接口、批量创建策略接口状态处理逻辑调整、创建策略后mq消息消费(推送审核中心与推送企微消息)

1 parent b965fc01
package cn.com.glsx.dj.strategy.enums;
/**
* 策略记录数据来源,1-策略中心 2-区域督导助手小程序 3-区域运营助手小程序
* 对应表字段:dj_car_life_strategy_info.data_source
*/
public enum StrategyDataSourceEnum {
/**
* 策略中心
*/
STRATEGY_CENTER(1, "策略中心"),
/**
* 区域督导助手小程序
*/
SUPERVISOR_MINI(2, "区域督导助手小程序"),
/**
* 区域运营助手小程序
*/
OPERATION_MINI(3, "区域运营助手小程序"),
;
private Integer value;
private String displayName;
StrategyDataSourceEnum(Integer value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public Integer getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
/**
* 根据 value 获取枚举
*/
public static StrategyDataSourceEnum getByValue(Integer value) {
if (value == null) {
return null;
}
for (StrategyDataSourceEnum item : values()) {
if (item.value.equals(value)) {
return item;
}
}
return null;
}
/**
* 根据 value 获取展示名称
*/
public static String getDisplayNameByValue(Integer value) {
StrategyDataSourceEnum item = getByValue(value);
return item == null ? null : item.displayName;
}
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.dj.strategy.model;
import cn.com.glsx.dj.strategy.dto.CollaborativeTaskDetailDTO;
import cn.com.glsx.dj.strategy.dto.MentoringApplicationDetailDTO;
import cn.com.glsx.dj.strategy.enums.StrategyDataSourceEnum;
import cn.com.glsx.dj.strategy.enums.StrategyPushFlagEnum;
import cn.com.glsx.dj.strategy.enums.StrategyPushType;
import cn.com.glsx.dj.strategy.enums.StrategyTypeEnum;
......@@ -121,6 +122,21 @@ public class StrategyInfo implements Serializable {
private String createdUUid;
/**
* 数据来源,1-策略中心 2-区域督导助手小程序 3-区域运营助手小程序
* @see StrategyDataSourceEnum
*/
@ApiModelProperty(notes = "数据来源,1-策略中心 2-区域督导助手小程序 3-区域运营助手小程序")
@Column(name = "data_source")
private Integer dataSource;
/**
* 数据来源id
*/
@ApiModelProperty(notes = "数据来源id")
@Column(name = "data_source_id")
private Long dataSourceId;
/**
* 创建人
*/
@Column(name = "created_by")
......
......@@ -25,6 +25,11 @@ public interface StrategyInfoRemote {
@ApiResponse("结果")
RpcResponse<Boolean> batchCreate(BatchInsertStrategyInfo batchStrategyInfo);
@ApiMethod("新增单个策略")
@ApiParam(name = "strategyInfo", notes = "策略信息(包含 merchantId/merchantName 以及 staffList/courseList/recordingList 等关联信息)", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("新创建的策略主键id")
RpcResponse<Integer> create(StrategyInfo strategyInfo);
@ApiMethod("删除策略")
@ApiParam(name = "strategyInfo", notes = "策略信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("结果")
......@@ -71,10 +76,10 @@ public interface StrategyInfoRemote {
@ApiResponse("驻店员工分页列表")
RpcResponse<RpcPagination<ShopMerchantStaffRespDTO>> listShopMerchantStaff(RpcPagination<ShopMerchantStaffReqDTO> pagination);
@ApiMethod("查询门店区域督导(飞行督导)信息")
@ApiMethod("查询门店区域督导(飞行督导)信息列表")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("区域督导(飞行督导)信息")
RpcResponse<ShopMerchantSupervisorRespDTO> getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO request);
@ApiResponse("区域督导(飞行督导)信息列表")
RpcResponse<List<ShopMerchantSupervisorRespDTO>> getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO request);
@ApiMethod("查询当前门店+业务下的全部区域运营")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
......
......@@ -15,6 +15,11 @@
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-supervisor-api</artifactId>
<version>5.8.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.6.1-SNAPSHOT</version>
......
......@@ -22,4 +22,10 @@ public class KafkaTopicConfig {
*/
@Value("${kafka.topic.unfinished-strategy-staff-topic:UNFINISHED_STRATEGY_STAFF_TOPIC}")
private String unfinishedStrategyStaffTopic;
/**
* 策略创建成功主题
*/
@Value("${kafka.topic.strategy-created-topic:STRATEGY_CREATED_TOPIC}")
private String strategyCreatedTopic;
}
\ No newline at end of file
package cn.com.glsx.dj.strategy.config;
import cn.com.glsx.dj.supervisor.remote.SupervisorSpecialCoachApprovalRemote;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SupervisorDubboConfig extends DubboConfig {
@Bean
public SupervisorSpecialCoachApprovalRemote supervisorSpecialCoachApprovalRemote() {
return factory.builder(SupervisorSpecialCoachApprovalRemote.class).check(check).timeout(timeout).version("1.0.0").build();
}
}
......@@ -22,9 +22,8 @@ import java.util.List;
@Component
public class StrategyPushConsumer extends KafkaConsumer {
/** 新推送逻辑覆盖的策略类型 */
/** 新推送逻辑覆盖的策略类型(排除带教申请,已迁移至 StrategyCreatedConsumer) */
private static final List<Integer> NEW_PUSH_STRATEGY_TYPES = Arrays.asList(
StrategyTypeEnum.MENTORING_APPLICATION.getValue(),
StrategyTypeEnum.PERSONNEL_CHANGE_EVAL.getValue(),
StrategyTypeEnum.BUSINESS_POLICY_UPDATE_EVAL.getValue(),
StrategyTypeEnum.MULTI_CATEGORY_EXPANSION.getValue(),
......@@ -95,10 +94,7 @@ public class StrategyPushConsumer extends KafkaConsumer {
Integer strategyType = strategyInfo.getStrategyType();
log.info("进入新推送逻辑,strategyId:{}, strategyType:{}", strategyInfo.getId(), strategyType);
if (StrategyTypeEnum.MENTORING_APPLICATION.getValue().equals(strategyType)) {
// 8-带教申请
processMentoringApplication(strategyInfo);
} else if (Arrays.asList(
if (Arrays.asList(
StrategyTypeEnum.PERSONNEL_CHANGE_EVAL.getValue(),
StrategyTypeEnum.BUSINESS_POLICY_UPDATE_EVAL.getValue(),
StrategyTypeEnum.MULTI_CATEGORY_EXPANSION.getValue(),
......@@ -109,14 +105,6 @@ public class StrategyPushConsumer extends KafkaConsumer {
}
/**
* 8-带教申请 推送处理
*/
private void processMentoringApplication(StrategyInfo strategyInfo) {
log.info("带教申请推送处理开始,strategyId:{}", strategyInfo.getId());
strategyInfoService.sendMentoringApplicationQWMessage(strategyInfo);
}
/**
* 9-人员更换评估、10-商务政策更新评估、11-多品类拓张、12-流量问题改善 推送处理
*/
private void processWorktoolStrategy(StrategyInfo strategyInfo) {
......
......@@ -62,6 +62,19 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
}
@Override
public RpcResponse<Integer> create(StrategyInfo strategyInfo) {
try {
return RpcResponse.success(strategyInfoService.create(strategyInfo));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<Boolean> delete(StrategyInfo strategyInfo) {
try {
return RpcResponse.success(strategyInfoService.delete(strategyInfo));
......@@ -197,15 +210,15 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
}
@Override
public RpcResponse<ShopMerchantSupervisorRespDTO> getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO request) {
public RpcResponse<List<ShopMerchantSupervisorRespDTO>> getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO request) {
try {
ShopMerchantSupervisorRespDTO result = shopMerchantService.getShopMerchantSupervisor(request);
List<ShopMerchantSupervisorRespDTO> result = shopMerchantService.getShopMerchantSupervisor(request);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("查询门店区域督导(飞行督导)信息 occur RpcServiceException", e);
log.error("查询门店区域督导(飞行督导)信息列表 occur RpcServiceException", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("查询门店区域督导(飞行督导)信息 occur Exception", e);
log.error("查询门店区域督导(飞行督导)信息列表 occur Exception", e);
return RpcResponse.error(e);
}
}
......
......@@ -116,30 +116,33 @@ public class ShopMerchantService {
}
/**
* 根据门店商户号和业务类型查询区域督导(飞行督导)信息
* 根据门店商户号和业务类型查询区域督导(飞行督导)信息列表
* 业务类型映射规则:
* 1-延保 → 2.1飞行督导(directorType=13)
* 2-轻改 → 1.1飞行督导(directorType=6)
* 3-权益 → 2.1飞行督导(directorType=13)
*
* @param condition 查询条件(门店商户号、业务类型)
* @return 区域督导(飞行督导)信息,最多一条
* @return 区域督导(飞行督导)信息列表
*/
public ShopMerchantSupervisorRespDTO getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO condition) {
public List<ShopMerchantSupervisorRespDTO> getShopMerchantSupervisor(ShopMerchantSupervisorReqDTO condition) {
Integer directorType = convertBusinessTypeToDirectorType(condition.getBusinessType());
List<ShopMerchantDirectorConfig> list = shopMerchantDirectorConfigMapper
.selectByMerchantIdAndType(condition.getMerchantId(), directorType);
if (CollectionUtils.isEmpty(list)) {
return null;
return new ArrayList<>();
}
List<ShopMerchantSupervisorRespDTO> result = new ArrayList<>();
for (ShopMerchantDirectorConfig config : list) {
ShopMerchantSupervisorRespDTO dto = new ShopMerchantSupervisorRespDTO();
dto.setMerchantId(config.getMerchantId());
dto.setDirectorType(config.getDirectorType());
dto.setDirectorUserId(config.getDirectorUserId());
dto.setDirectorName(config.getDirectorName());
dto.setDirectorPhone(config.getDirectorPhone());
result.add(dto);
}
ShopMerchantDirectorConfig config = list.get(0);
ShopMerchantSupervisorRespDTO dto = new ShopMerchantSupervisorRespDTO();
dto.setMerchantId(config.getMerchantId());
dto.setDirectorType(config.getDirectorType());
dto.setDirectorUserId(config.getDirectorUserId());
dto.setDirectorName(config.getDirectorName());
dto.setDirectorPhone(config.getDirectorPhone());
return dto;
return result;
}
/**
......
......@@ -14,6 +14,7 @@ import cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote;
import cn.com.glsx.dj.strategy.config.DataStatsConfig;
import cn.com.glsx.dj.strategy.config.KafkaTopicConfig;
import cn.com.glsx.dj.strategy.config.MentoringApplicationConfig;
import cn.com.glsx.dj.supervisor.remote.SupervisorSpecialCoachApprovalRemote;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.WorkWechatTextMessageDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.request.SendWorkWechatMessageRequestDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.response.SendWorkWechatMessageResponseDTO;
......@@ -112,6 +113,9 @@ public class StrategyInfoService {
@Resource
private SceneRemote sceneRemote;
@Resource
private SupervisorSpecialCoachApprovalRemote supervisorSpecialCoachApprovalRemote;
public List<StrategyInfo> queryStrategyInfoList(Integer strategyType) {
Example example = new Example(StrategyInfo.class);
......@@ -144,7 +148,7 @@ public class StrategyInfoService {
strategyInfo.setDeletedFlag(DeleteFlagEnum.N.getValue());
strategyInfo.setCreatedDate(date);
strategyInfo.setCreatedBy(batchStrategyInfo.getCreatedBy());
strategyInfo.setPushFlag(StrategyPushFlagEnum.NOT_PUSHED.getValue());
strategyInfo.setPushFlag(resolveInitPushFlag(baseStrategyInfo.getStrategyType()));
strategyInfo.setCreatedUUid(batchStrategyInfo.getCreatedUUid());
return strategyInfo;
}).collect(Collectors.toList());
......@@ -166,10 +170,64 @@ public class StrategyInfoService {
}).start();
}
//创建成功后发送 MQ 消息(异步发送,避免受未提交事务影响)
new Thread(() -> strategyInfoList.forEach(x -> sendStrategyCreatedMessage(x.getId()))).start();
return Boolean.TRUE;
}
/**
* 创建单个策略记录
* <p>逻辑与 {@link #batchCreate(BatchInsertStrategyInfo)} 保持一致,
* 仅针对单个门店场景,门店信息、关联人员/课程/录音、
* 创建人以及数据来源等字段均从 {@link StrategyInfo} 本身传入。</p>
*
* @param strategyInfo 策略信息(含 merchantId/merchantName/staffList/courseList/recordingList 等)
* @return 新创建的策略主键id
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public Integer create(StrategyInfo strategyInfo) {
if (Objects.isNull(strategyInfo)) {
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "策略信息不能为空");
}
if (Objects.isNull(strategyInfo.getMerchantId())) {
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "门店ID不能为空");
}
//设置默认推送方式
if (Objects.isNull(strategyInfo.getPushType())) {
strategyInfo.setPushType(StrategyPushType.TIMED_PUSH.getValue());
}
Date date = new Date();
strategyInfo.setDeletedFlag(DeleteFlagEnum.N.getValue());
strategyInfo.setCreatedDate(date);
strategyInfo.setPushFlag(resolveInitPushFlag(strategyInfo.getStrategyType()));
//插入策略基础信息(主键回填到 strategyInfo.id)
strategyInfoMapper.insertSelective(strategyInfo);
List<StrategyInfo> strategyInfoList = Collections.singletonList(strategyInfo);
//插入策略人员关联信息
if (!CollectionUtils.isEmpty(strategyInfo.getStaffList())) {
strategyStaffRelService.batchInsert(strategyInfoList, strategyInfo.getStaffList(), SceneTypeEnum.SCENE1_0.getValue());
}
//插入策略课程关联关系
if (!CollectionUtils.isEmpty(strategyInfo.getCourseList())) {
strategyCourseRelService.batchInsert(strategyInfoList, strategyInfo.getCourseList());
}
//插入策略-录音关联关系
if (!CollectionUtils.isEmpty(strategyInfo.getRecordingList())) {
strategyRecordingRelService.batchInsert(strategyInfoList, strategyInfo.getRecordingList());
}
//判断是否需要立即推送消息
if (StrategyPushType.IMMEDIATE_PUSH.getValue().equals(strategyInfo.getPushType())) {
final Integer strategyId = strategyInfo.getId();
new Thread(() -> sendStrategyPushMessage(strategyId)).start();
}
//创建成功后发送 MQ 消息(异步发送,避免受未提交事务影响)
final Integer createdStrategyId = strategyInfo.getId();
new Thread(() -> sendStrategyCreatedMessage(createdStrategyId)).start();
return strategyInfo.getId();
}
/**
* 需要"未完成"状态才能删除的策略类型集合
* 人员更换评估(9)、商务政策更新评估(10)、多品类拓张(11)、流量问题改善(12)
*/
......@@ -181,6 +239,24 @@ public class StrategyInfoService {
));
/**
* 根据策略类型计算 pushFlag 初始状态。
* <ul>
* <li>带教申请(8):初始为 APPROVING(审批中=3)</li>
* <li>人员更换评估(9)/商务政策更新评估(10)/多品类拓张(11)/流量问题改善(12):初始为 UNFINISHED(未完成=2)</li>
* <li>其他类型:保持原有逻辑初始为 NOT_PUSHED(未推送=0)</li>
* </ul>
*/
private Integer resolveInitPushFlag(Integer strategyType) {
if (StrategyTypeEnum.MENTORING_APPLICATION.getValue().equals(strategyType)) {
return StrategyPushFlagEnum.APPROVING.getValue();
}
if (UNFINISHED_DELETABLE_TYPES.contains(strategyType)) {
return StrategyPushFlagEnum.UNFINISHED.getValue();
}
return StrategyPushFlagEnum.NOT_PUSHED.getValue();
}
/**
* 删除策略
* 删除规则:
* 1. 带教申请(MENTORING_APPLICATION=8):仅状态=审批中(APPROVING=3) 可删除
......@@ -349,6 +425,7 @@ public class StrategyInfoService {
MentoringApplicationDetailDTO detail = new MentoringApplicationDetailDTO();
// 1. 查询审批信息(TODO: 对接外部remote接口)
// supervisorSpecialCoachApprovalRemote.getApprovalTaskDetail()
MentoringApprovalInfoDTO approvalInfo = queryMentoringApprovalInfo(strategyInfo.getId());
detail.setApprovalInfo(approvalInfo);
......@@ -650,6 +727,27 @@ public class StrategyInfoService {
}
/**
* 发送策略创建成功kafka消息。
* <p>仅发送 strategyId,不报出异常以免影响外部事务。</p>
*
* @param strategyId 策略主键id
*/
public void sendStrategyCreatedMessage(Integer strategyId) {
if (strategyId == null) {
log.warn("策略ID为空,无法发送策略创建成功消息");
return;
}
try {
String message = String.valueOf(strategyId);
log.info("准备发送策略创建成功消息,策略ID:{}, Topic:{}", strategyId, kafkaTopicConfig.getStrategyCreatedTopic());
kafkaProducer.send(kafkaTopicConfig.getStrategyCreatedTopic(), message.getBytes());
log.info("策略创建成功消息发送成功,策略ID:{}", strategyId);
} catch (Exception e) {
log.error("策略创建成功消息发送异常,策略ID:{}", strategyId, e);
}
}
/**
* 策略中心-门店分析-历史人员记录
*
* @param merchantId
......
......@@ -24,6 +24,8 @@
<result column="biz" property="biz" />
<result column="push_flag" property="pushFlag"/>
<result column="created_uuid" property="createdUUid"/>
<result column="data_source" property="dataSource" jdbcType="INTEGER" />
<result column="data_source_id" property="dataSourceId" jdbcType="BIGINT" />
<collection property="staffList" ofType="cn.com.glsx.dj.strategy.model.StrategyStaffRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper.selectByStrategyId" />
<collection property="courseList" ofType="cn.com.glsx.dj.strategy.model.StrategyCourseRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyCourseRelMapper.selectByStrategyId" />
<collection property="recordingList" ofType="cn.com.glsx.dj.strategy.model.StrategyRecordingRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyRecordingRelMapper.selectByStrategyId" />
......@@ -39,7 +41,8 @@
WARNING - @mbg.generated
-->
id, strategy_type, title, sub_title, merchant_id, merchant_name, start_date, end_date, description, handler_type,
push_type, created_by, created_date, updated_by, updated_date, deleted_flag, merchant_id, merchant_name, biz, push_flag, created_uuid
push_type, created_by, created_date, updated_by, updated_date, deleted_flag, merchant_id, merchant_name, biz, push_flag, created_uuid,
data_source, data_source_id
</sql>
<sql id="Blob_Column_List" >
<!--
......
  • @wangxw1
    commented
    Master

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

    1. 事务与异步消息发送存在竞态条件及严重的线程管理问题(稳定性与正确性,极高风险)

    • 问题描述:在 StrategyInfoService.java 的 batchCreate 和 create 方法中,使用了 new Thread(() -> sendStrategyCreatedMessage(...)).start(); 来尝试“避免受未提交事务影响”。
    • 影响分析:
      1. 竞态条件与脏读:new Thread 启动后会立即执行,此时主线程的 Spring 事务(@Transactional)可能尚未提交。Kafka 消费者收到消息后去数据库查询策略详情,大概率会查不到数据。
      2. 回滚导致幽灵消息:如果 new Thread 执行后,主线程后续逻辑抛出异常导致事务回滚,MQ 消息已经发出,会导致消费者处理脏数据。
      3. 资源耗尽:在企业级应用中直接使用 new Thread().start() 属于严重违背最佳实践,高并发下会导致线程数失控、OOM 或 CPU 耗尽。
    • 优化建议:废弃显式创建线程的做法。建议使用 Spring 提供的事务同步管理器 TransactionSynchronizationManager,或者 @TransactionalEventListener 来确保在事务成功提交后再发送 MQ 消息。 代码示例: ```java // 方案一:使用 TransactionSynchronizationManager final Integer createdStrategyId = strategyInfo.getId(); TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { sendStrategyCreatedMessage(createdStrategyId); } });

    // 方案二(推荐):发布本地事件,配合 @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) 进行解耦和异步处理。

    
    **2. Dubbo 接口返回值发生破坏性变更(稳定性与兼容性,高风险)**
    - **问题描述**:在 `StrategyInfoRemote.java` 中,`getShopMerchantSupervisor` 方法的返回值由 `RpcResponse<ShopMerchantSupervisorRespDTO>` 变更为了 `RpcResponse<List<ShopMerchantSupervisorRespDTO>>`。
    - **影响分析**:虽然请求参数未变,但**修改已有 Dubbo 接口的返回值类型属于严重的破坏性变更(Breaking Change)**。所有依赖该接口的旧版消费者在反序列化时会直接报错(类型转换异常),导致线上服务调用失败。
    - **优化建议**:微服务架构中,已有接口应遵循“开闭原则”。
      1. **回退更改**:保留原 `getShopMerchantSupervisor` 接口及其返回值(可根据业务逻辑默认返回 List 中的第一个元素以兼容老业务)。
      2. **新增接口**:新增一个接口(例如命名为 `listShopMerchantSupervisor`),返回 `List` 类型,供新的业务场景使用。
    
    **3. Stream 流处理存在潜在的空指针异常(健壮性,中风险)**
    - **问题描述**:在 `StrategyCreatedConsumer.java` 中,提取人员手机号和姓名时,直接对集合元素调用方法引用,如 `staffList.stream().map(StrategyStaffRel::getUserPhone)...`。
    - **影响分析**:如果 `staffList` 或 `supervisors` 集合中存在 `null` 元素,`map` 操作调用 `getUserPhone` 时会直接抛出 `NullPointerException`,导致整个 Kafka 消息消费失败且可能陷入不断重试的死循环。
    - **优化建议**:在执行 `map` 提取属性之前,先使用 `filter` 过滤掉可能的空对象。
      *代码示例*:
      ```java
      String teachingStaffPhones = staffList.stream()
              .filter(Objects::nonNull) // 增加空对象过滤
              .map(StrategyStaffRel::getUserPhone)
              .filter(StringUtils::isNotBlank)
              .collect(Collectors.joining(","));
    

    二、评分明细

    • 功能实现的正确性与健壮性(32/40分):核心业务流转逻辑正确,未发现 MyBatis 子查询违规。但“通过 new Thread 发送 MQ 消息规避事务未提交”的设计存在严重的逻辑漏洞(大概率导致消费者查不到数据),扣除 8 分。
    • 安全性与潜在风险(30/30分):SQL 均为常规操作,未发现明显的 SQL 注入、越权或敏感信息直接暴露的风险。
    • 最佳实践与可维护性(12/20分):直接修改已有 Dubbo 接口的返回值破坏了向后兼容性;在 Spring 环境中直接使用 new Thread 严重违反工程规范,扣除 8 分。
    • 性能与资源利用(3/5分):Kafka 消费逻辑中直接同步调用外部 Dubbo 服务(supervisorSpecialCoachApprovalRemote),若 RPC 超时会阻塞消费线程;频繁 new Thread 存在资源浪费和失控风险,扣除 2 分。
    • 提交信息质量(5/5分):Commit 信息详尽,清晰地描述了本次代码变更的业务背景、接口调整和 MQ 消费逻辑,具备良好的可追溯性。

    总分:82分

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