feat(emergency): searchExpert接口返回ConDoctor专家数据 + 修复IM UserSig缓存key未区分secretKey的问题
1. searchExpert新增ConDoctor专家字段:
- 新增ConDoctorMapper直接查询qh_con_doctor表(同库,避免跨模块依赖)
- EmergencyProfessionUser新增17个@TableField(exist=false)字段承载专家数据
- searchExpert方法中批量查询ConDoctor并逐字段填充
- 用户非专家时ConDoctor字段为null
- 更新API文档-移动端接口.md
2. IM签名缓存优化:
- TencentCloudImUtil新增secretKey注入
- Redis key从 silence:im_user_sig:{sdkAppId}:{id}
改为 silence:im_user_sig:{hash(sdkAppId+secretKey)}:{id}
- 解决secretKey变更时旧缓存签名仍被命中导致IM请求失败的问题
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+37
@@ -80,6 +80,8 @@ public class EmergencyOrderApiServiceImpl implements EmergencyOrderApiService {
|
||||
@Autowired
|
||||
private EmergencyProfessionUserMapper emergencyProfessionUserMapper;
|
||||
@Autowired
|
||||
private ConDoctorMapper conDoctorMapper;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private EmergencyCloudManager emergencyCloudManager;
|
||||
@@ -960,6 +962,41 @@ public class EmergencyOrderApiServiceImpl implements EmergencyOrderApiService {
|
||||
}
|
||||
});
|
||||
}
|
||||
// 批量查询 con_doctor 专家资料,补充专家字段
|
||||
if (!userIds.isEmpty()) {
|
||||
List<EmergencyProfessionUser> doctorList = conDoctorMapper.selectDoctorByIds(userIds);
|
||||
if (CollectionUtils.isNotEmpty(doctorList)) {
|
||||
Map<String, EmergencyProfessionUser> doctorMap = doctorList.stream()
|
||||
.collect(Collectors.toMap(EmergencyProfessionUser::getUserId, e -> e, (a, b) -> a));
|
||||
result.getRecords().forEach(prof -> {
|
||||
EmergencyProfessionUser doc = doctorMap.get(prof.getUserId());
|
||||
if (doc == null) {
|
||||
return;
|
||||
}
|
||||
prof.setDoctorName(doc.getDoctorName());
|
||||
prof.setDoctorNo(doc.getDoctorNo());
|
||||
prof.setPhoto(doc.getPhoto());
|
||||
prof.setResourceName(doc.getResourceName());
|
||||
prof.setDepartmentId(doc.getDepartmentId());
|
||||
prof.setDepartmentName(doc.getDepartmentName());
|
||||
prof.setDoctorTitle(doc.getDoctorTitle());
|
||||
prof.setDoctorJob(doc.getDoctorJob());
|
||||
prof.setDoctorStatus(doc.getDoctorStatus());
|
||||
prof.setIsAccept(doc.getIsAccept());
|
||||
prof.setDoctorType(doc.getDoctorType());
|
||||
prof.setAudioStatus(doc.getAudioStatus());
|
||||
prof.setTfJumpHoliday(doc.getTfJumpHoliday());
|
||||
prof.setExperience(doc.getExperience());
|
||||
prof.setSort(doc.getSort());
|
||||
prof.setTfRecommend(doc.getTfRecommend());
|
||||
prof.setIntroduction(doc.getIntroduction());
|
||||
// 已有字段,con_doctor 有值时覆盖为更权威的专家资料
|
||||
if (StrUtil.isNotBlank(doc.getGoodAt())) prof.setGoodAt(doc.getGoodAt());
|
||||
if (StrUtil.isNotBlank(doc.getSchool())) prof.setSchool(doc.getSchool());
|
||||
if (StrUtil.isNotBlank(doc.getEdu())) prof.setEdu(doc.getEdu());
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.renkang.emergency.mapper;
|
||||
|
||||
import com.renkang.emergency.entity.EmergencyProfessionUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 咨询服务医生表(qh_con_doctor) 查询
|
||||
* 说明:health-emergency 与 health-consultation 共用同一数据库,
|
||||
* 但模块间无依赖,故在应急模块内直接查询 qh_con_doctor。
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConDoctorMapper {
|
||||
|
||||
/**
|
||||
* 根据医生id(=应急用户userId)批量查询专家资料
|
||||
* 仅返回有效医生:del_flag='0' 且 status='1'
|
||||
*
|
||||
* @param doctorIds 医生id集合
|
||||
* @return 以 EmergencyProfessionUser 承载 con_doctor 字段(仅填充新增的 exist=false 字段与 goodAt/school/edu)
|
||||
*/
|
||||
@Select("<script>" +
|
||||
"SELECT id AS userId, " +
|
||||
"doctor_name AS doctorName, doctor_no AS doctorNo, photo, " +
|
||||
"resource_name AS resourceName, department_id AS departmentId, department_name AS departmentName, " +
|
||||
"doctor_title AS doctorTitle, doctor_job AS doctorJob, doctor_status AS doctorStatus, " +
|
||||
"is_accept AS isAccept, type AS doctorType, audio_status AS audioStatus, tf_jump_holiday AS tfJumpHoliday, " +
|
||||
"experience, good_at AS goodAt, school, e_q AS edu, sort, " +
|
||||
"tf_recommend AS tfRecommend, introduction " +
|
||||
"FROM qh_con_doctor " +
|
||||
"WHERE del_flag = '0' AND status = '1' AND id IN " +
|
||||
"<foreach collection='doctorIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>" +
|
||||
"</script>")
|
||||
List<EmergencyProfessionUser> selectDoctorByIds(@Param("doctorIds") List<String> doctorIds);
|
||||
}
|
||||
Reference in New Issue
Block a user