|
@@ -54,6 +54,8 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
@Resource
|
|
|
private SmsSendService smsSendService;
|
|
|
@Resource
|
|
|
+ private VoiceSendService voiceSendService;
|
|
|
+ @Resource
|
|
|
private CareHouseOlderRelService careHouseOlderRelService;
|
|
|
|
|
|
/**
|
|
@@ -145,9 +147,16 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
List<CareEventOrderChamb> chambList = addChamberlainToOrder(order);
|
|
|
List<CareEventOrderContactStatus> contacts = addContactToOrderContact(order);
|
|
|
sendSms(order,chambList,contacts);
|
|
|
+ sendVoice(order,chambList,contacts);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 发送短信
|
|
|
+ * @param order
|
|
|
+ * @param chambList
|
|
|
+ * @param contacts
|
|
|
+ */
|
|
|
private void sendSms(CareEventOrder order,List<CareEventOrderChamb> chambList,List<CareEventOrderContactStatus> contacts){
|
|
|
try{
|
|
|
Object switchSms = redisUtil.get(RedisKeyConstant.SWITCH_SMS);
|
|
@@ -208,6 +217,81 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
log.error("发送短信通知失败",e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送语音通知
|
|
|
+ * @param order
|
|
|
+ * @param chambList
|
|
|
+ * @param contacts
|
|
|
+ */
|
|
|
+ private void sendVoice(CareEventOrder order,List<CareEventOrderChamb> chambList,List<CareEventOrderContactStatus> contacts){
|
|
|
+ try{
|
|
|
+ Object switchVoice = redisUtil.get(RedisKeyConstant.SWITCH_VOICE);
|
|
|
+ if (switchVoice != null){
|
|
|
+ //给联系人发送语音通知
|
|
|
+ CareHouse house = this.careHouseService.getById(order.getHouseId());
|
|
|
+ if (CollUtil.isNotEmpty(contacts)){
|
|
|
+ contacts.forEach(item ->{
|
|
|
+ boolean voiceResult = false;
|
|
|
+ String[] params = null;
|
|
|
+ if (OrderTypeEnum.JIU_ZHI.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"久滞",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceHappen(item.getContactPhone(),params);
|
|
|
+ } else if(OrderTypeEnum.DIE_DAO.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"跌倒",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceHappen(item.getContactPhone(),params);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (voiceResult) {
|
|
|
+ CareEventOrderHandleHis his2 = new CareEventOrderHandleHis();
|
|
|
+ his2.setOrgId(item.getOrgId());
|
|
|
+ his2.setStationId(item.getStationId());
|
|
|
+ his2.setOrderId(item.getOrderId());
|
|
|
+ his2.setLogType(LogTypeEnum.SMS.getValue());
|
|
|
+ his2.setLogObjectId(item.getContactId());
|
|
|
+ his2.setLogObjectName(item.getContactName());
|
|
|
+ his2.setLogResult("语音通知");
|
|
|
+ his2.setOpUserRole(UserRoleEnum.SEAT.getValue());
|
|
|
+ his2.setCreateTime(DateUtil.date());
|
|
|
+ his2.setRelationTypeDesc(item.getRelationTypeDesc());
|
|
|
+ this.careEventOrderHandleHisService.save(his2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //给管家发语音通知
|
|
|
+ if (CollUtil.isNotEmpty(chambList)){
|
|
|
+ chambList.forEach(item ->{
|
|
|
+ boolean voiceResult = false;
|
|
|
+ String[] params = null;
|
|
|
+ if (OrderTypeEnum.JIU_ZHI.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"久滞",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceHappen(item.getPhone(),params);
|
|
|
+ }else if(OrderTypeEnum.DIE_DAO.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"跌倒",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceHappen(item.getPhone(),params);
|
|
|
+ }
|
|
|
+ if (voiceResult){
|
|
|
+ CareEventOrderHandleHis his2 = new CareEventOrderHandleHis();
|
|
|
+ his2.setOrgId(item.getOrgId());
|
|
|
+ his2.setStationId(item.getStationId());
|
|
|
+ his2.setOrderId(item.getOrderId());
|
|
|
+ his2.setLogType(LogTypeEnum.SMS.getValue());
|
|
|
+ his2.setLogObjectId(item.getChambId());
|
|
|
+ his2.setLogObjectName(item.getChambName());
|
|
|
+ his2.setLogResult("语音通知");
|
|
|
+ his2.setOpUserRole(UserRoleEnum.SEAT.getValue());
|
|
|
+ his2.setCreateTime(DateUtil.date());
|
|
|
+ his2.setRelationTypeDesc("管家");
|
|
|
+ this.careEventOrderHandleHisService.save(his2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("发送语音通知失败",e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将老人加入到 工单中
|
|
|
* @param order
|
|
@@ -322,9 +406,9 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
orderDb.setId(order.getId());
|
|
|
this.saveHisOrder(order, orderDb,true);
|
|
|
cancelEventSMSNotic(order);
|
|
|
+ cancelEventVoiceNotic(order);
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 取消事件,短信通知
|
|
|
* @param order
|
|
@@ -396,4 +480,82 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
log.error("发送短信通知失败",e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取消事件,语音通知
|
|
|
+ * @param order
|
|
|
+ */
|
|
|
+ private void cancelEventVoiceNotic(CareEventOrder order){
|
|
|
+ try{
|
|
|
+ Object switchVoice = redisUtil.get(RedisKeyConstant.SWITCH_VOICE);
|
|
|
+ if (switchVoice != null){
|
|
|
+ List<CareEventOrderChamb> chambList = new ArrayList<>();
|
|
|
+ CareEventOrderChamb chamb = this.careEventOrderChambService.getChambOrderByOrderId(order.getId());
|
|
|
+ chambList.add(chamb);
|
|
|
+ QueryWrapper<CareEventOrderContactStatus> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(CareEventOrderContactStatus::getOrderId,order.getId());
|
|
|
+ List<CareEventOrderContactStatus> contacts = this.careEventOrderContactStatusService.list(queryWrapper);
|
|
|
+
|
|
|
+ //给联系人发送语音
|
|
|
+ CareHouse house = this.careHouseService.getById(order.getHouseId());
|
|
|
+ if (CollUtil.isNotEmpty(contacts)){
|
|
|
+ contacts.forEach(item ->{
|
|
|
+ boolean voiceResult = false;
|
|
|
+ String[] params = null;
|
|
|
+ if (OrderTypeEnum.JIU_ZHI.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"久滞",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceCancel(item.getContactPhone(),params);
|
|
|
+ }else if(OrderTypeEnum.DIE_DAO.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"跌倒",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceCancel(item.getContactPhone(),params);
|
|
|
+ }
|
|
|
+ if (voiceResult){
|
|
|
+ CareEventOrderHandleHis his2 = new CareEventOrderHandleHis();
|
|
|
+ his2.setOrgId(item.getOrgId());
|
|
|
+ his2.setStationId(item.getStationId());
|
|
|
+ his2.setOrderId(item.getOrderId());
|
|
|
+ his2.setLogType(LogTypeEnum.SMS.getValue());
|
|
|
+ his2.setLogObjectId(item.getContactId());
|
|
|
+ his2.setLogObjectName(item.getContactName());
|
|
|
+ his2.setLogResult("事件取消语音通知");
|
|
|
+ his2.setOpUserRole(UserRoleEnum.SEAT.getValue());
|
|
|
+ his2.setCreateTime(DateUtil.date());
|
|
|
+ his2.setRelationTypeDesc(item.getRelationTypeDesc());
|
|
|
+ this.careEventOrderHandleHisService.save(his2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //给管家发短信
|
|
|
+ if (CollUtil.isNotEmpty(chambList)){
|
|
|
+ chambList.forEach(item ->{
|
|
|
+ boolean voiceResult = false;
|
|
|
+ String[] params = null;
|
|
|
+ if (OrderTypeEnum.JIU_ZHI.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"久滞",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceCancel(item.getPhone(),params);
|
|
|
+ }else if(OrderTypeEnum.DIE_DAO.getValue().equals(order.getOrderType())){
|
|
|
+ params = new String[]{DateUtil.format(order.getCreateTime(),"yyyy年MM月dd日HH时mm分ss秒"),"跌倒",house.getName()};
|
|
|
+ voiceResult = voiceSendService.sendVoiceCancel(item.getPhone(),params);
|
|
|
+ }
|
|
|
+ if (voiceResult){
|
|
|
+ CareEventOrderHandleHis his2 = new CareEventOrderHandleHis();
|
|
|
+ his2.setOrgId(item.getOrgId());
|
|
|
+ his2.setStationId(item.getStationId());
|
|
|
+ his2.setOrderId(item.getOrderId());
|
|
|
+ his2.setLogType(LogTypeEnum.SMS.getValue());
|
|
|
+ his2.setLogObjectId(item.getChambId());
|
|
|
+ his2.setLogObjectName(item.getChambName());
|
|
|
+ his2.setLogResult("事件取消语音通知");
|
|
|
+ his2.setOpUserRole(UserRoleEnum.SEAT.getValue());
|
|
|
+ his2.setCreateTime(DateUtil.date());
|
|
|
+ his2.setRelationTypeDesc("管家");
|
|
|
+ this.careEventOrderHandleHisService.save(his2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("发送语音通知失败",e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|