预约时通知服务顾问

This commit is contained in:
xiaofajia 2024-11-06 16:01:49 +08:00
parent 2a182b0614
commit ffbf0130d6
2 changed files with 15 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket; import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket;
import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper; import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
@ -223,7 +224,7 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
public void sentMessage(Long userId, String text) { public void sentMessage(Long userId, String text) {
try { try {
//获取当前登录用户 //获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 准备发送参数 // 准备发送参数
Map<String, Object> templateParams = new HashMap<>(); Map<String, Object> templateParams = new HashMap<>();
// 发送模版内容 // 发送模版内容
@ -232,8 +233,9 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO() sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
.setUserId(userId) .setUserId(userId)
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams)); .setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
//发送语音提醒 //发送语音提醒---小李---通过租户上下文去取租户ID
notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString()); // notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
notifyMessageSocket.sendMessage(text, TenantContextHolder.getRequiredTenantId().toString(), userId.toString());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -7,7 +7,9 @@ import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.app.booking.vo.BookingQueryVO; import cn.iocoder.yudao.module.app.booking.vo.BookingQueryVO;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.mapper.DlRepairBookingMapper; import cn.iocoder.yudao.module.booking.mapper.DlRepairBookingMapper;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
@ -67,6 +69,9 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
@Autowired @Autowired
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@Resource
private RepairWorkerService repairWorkerService;
/** /**
* 维修预约表 新增修改 * 维修预约表 新增修改
* *
@ -91,12 +96,14 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
// 选择了服务顾问 // 选择了服务顾问
if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){ if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){
// 站内信通知 // 发送消息通知
// websocket通知 repairWorkerService.sentMessage(Long.valueOf(repairBookingRespVO.getAdviserId()), message);
}else { }else {
// 没选服务顾问 // 没选服务顾问
// 获取所有的服务顾问 // 获取所有的服务顾问
// 站内信通知和websocket通知 List<UserDTO> allServicer = getAllServicer(TenantContextHolder.getRequiredTenantId());
// 发送消息通知
allServicer.forEach(item -> repairWorkerService.sentMessage(item.getId(), message));
} }
// 正常的新增修改 // 正常的新增修改