预约时通知服务顾问
This commit is contained in:
parent
2a182b0614
commit
ffbf0130d6
@ -5,6 +5,7 @@ import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
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.base.entity.RepairWorker;
|
||||
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) {
|
||||
try {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 准备发送参数
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
// 发送模版内容
|
||||
@ -232,8 +233,9 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
||||
.setUserId(userId)
|
||||
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
|
||||
//发送语音提醒
|
||||
notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
||||
//发送语音提醒---小李---通过租户上下文去取租户ID
|
||||
// notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
||||
notifyMessageSocket.sendMessage(text, TenantContextHolder.getRequiredTenantId().toString(), userId.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
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.context.TenantContextHolder;
|
||||
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.mapper.DlRepairBookingMapper;
|
||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||
@ -67,6 +69,9 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
@Autowired
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private RepairWorkerService repairWorkerService;
|
||||
|
||||
/**
|
||||
* 维修预约表 新增、修改
|
||||
*
|
||||
@ -91,12 +96,14 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
|
||||
|
||||
// 选择了服务顾问
|
||||
if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){
|
||||
// 站内信通知
|
||||
// websocket通知
|
||||
// 发送消息通知
|
||||
repairWorkerService.sentMessage(Long.valueOf(repairBookingRespVO.getAdviserId()), message);
|
||||
}else {
|
||||
// 没选服务顾问
|
||||
// 获取所有的服务顾问
|
||||
// 站内信通知和websocket通知
|
||||
List<UserDTO> allServicer = getAllServicer(TenantContextHolder.getRequiredTenantId());
|
||||
// 发送消息通知
|
||||
allServicer.forEach(item -> repairWorkerService.sentMessage(item.getId(), message));
|
||||
}
|
||||
|
||||
// 正常的新增、修改
|
||||
|
Loading…
Reference in New Issue
Block a user