feat: 补充IM个人资料同步 + 群成员头像导入修复

1. 在8处头像/名称变更点补充imHelloApi.accountReg()调用,同步更新IM个人资料:
   - SysUserController.updateUserAvatar 用户换头像
   - SysUserController.appEdit 移动端编辑资料
   - SysUserController.edit 后台编辑用户
   - EmergencyProfessionUserServiceImpl.customEdit 应急人员编辑
   - EmergencyCenterAdminServiceImpl.updateAdmin 中心管理员编辑
   - HealthUserEmployeeExServiceImpl.updateUserInfo 员工编辑
   - ConDoctorApiController.update 专家端个人简介修改
   - AsyncExportService.importDoctor 批量导入医生
   所有syncImProfile方法内部try-catch兜底,失败不影响主流程。
2. AddGroupMemberDTO新增memberAvatar字段,TencentCloudImUtil.addGroupMember
   导入IM账号时传递FaceUrl,EmergencyApiServiceImpl.addGroupUser构建头像映射。
3. jeecg-system-biz/pom.xml新增health-im-api依赖。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-04 20:03:20 +08:00
co-authored by Claude
parent 0ae963c4cf
commit 4a15ebe0d2
11 changed files with 198 additions and 5 deletions
@@ -15,24 +15,31 @@ import com.renkang.consultation.entity.ConDoctorExAndUser;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.util.TempUtil;
import com.renkang.consultation.vo.ConDoctorVO;
import com.renkang.im.api.IMHelloApi;
import com.renkang.im.entity.ConSessionRequestDO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.bean.request.ListUser;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.util.DictUtil;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.LoginUserNew;
import org.jeecg.util.RSAEncryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping(RequestPrefix.conDoctor)
public class ConDoctorApiController {
@@ -46,6 +53,8 @@ public class ConDoctorApiController {
@Autowired
private DictUtil dictUtil;
@Autowired
private IMHelloApi imHelloApi;
/**
* 分页列表查询
@@ -133,12 +142,28 @@ public class ConDoctorApiController {
}
boolean flag = conDoctorService.updateById(conDoctor);
if (flag){
// 同步IM个人资料
syncImProfile(conDoctor.getId());
return Result.ok("更新成功!");
}
return Result.error("更新失败!");
}
private void syncImProfile(String userId) {
try {
List<LoginUserNew> users = isysBaseApi.listUserByIds(new ListUser(Collections.singletonList(userId)));
if (CollectionUtils.isEmpty(users)) {
return;
}
ConSessionRequestDO req = new ConSessionRequestDO();
req.setAccountList(Collections.singletonList(users.get(0)));
imHelloApi.accountReg(req);
} catch (Exception e) {
log.error("同步IM个人资料失败, userId: {}", userId, e);
}
}
@Operation(summary = "查询医生信息", description = "查询医生信息")
@GetMapping("/selectDoctorInfo")
@@ -19,6 +19,8 @@ import com.renkang.consultation.mapper.ConSessionMapper;
import com.renkang.consultation.service.IConDoctorService;
import com.renkang.consultation.service.IConSessionService;
import com.renkang.consultation.vo.ConDoctorExportVO;
import com.renkang.im.api.IMHelloApi;
import com.renkang.im.entity.ConSessionRequestDO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -98,6 +100,8 @@ public class AsyncExportService {
private ConHelperMapper conHelperMapper;
@Autowired
private AsyncTaskExecutor taskExecutor;
@Autowired
private IMHelloApi imHelloApi;
@Transactional(rollbackFor = Exception.class)
public void userToDoctorExportXls(ConSessionDTO dto, CommonExportsInfo info, String empFinish, String errCode, String sheetName, String fileName) {
@@ -580,6 +584,8 @@ public class AsyncExportService {
BeanUtils.copyProperties(excelVo, conDoctor);
conDoctor.setId(userId);
conDoctorService.saveDoctor(conDoctor);
// 同步注册IM账号
importImAccount(userId);
info.setHandleMsg(index++ + "/" + userList.size());
info.setExportStatus("0");
info.setId(commonExportsInfo.getId());
@@ -598,6 +604,20 @@ public class AsyncExportService {
sysBaseAPI.updateExportsInfo(info);
}
private void importImAccount(String userId) {
try {
List<LoginUserNew> users = sysBaseAPI.listUserByIds(new ListUser(Collections.singletonList(userId)));
if (CollectionUtils.isEmpty(users)) {
return;
}
ConSessionRequestDO req = new ConSessionRequestDO();
req.setAccountList(java.util.Collections.singletonList(users.get(0)));
imHelloApi.accountReg(req);
} catch (Exception e) {
log.error("导入IM账号失败, userId: {}", userId, e);
}
}
private class UserToDoctorExportHandler implements PoiExportHandler<UserToDoctorExport, SessionFilter> {
@Override