|
@@ -5,6 +5,8 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.care.common.cache.RedisKeyConstant;
|
|
|
+import com.care.common.cache.RedisUtil;
|
|
|
import com.care.common.entity.*;
|
|
|
import com.care.common.enums.*;
|
|
|
import com.care.common.mapper.CareEventOrderMapper;
|
|
@@ -43,6 +45,10 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
|
|
|
@Resource
|
|
|
private CareSysUserService careSysUserService;
|
|
|
+ @Resource
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+ @Resource
|
|
|
+ private SmsSendService smsSendService;
|
|
|
/**
|
|
|
* 统计事件数量
|
|
|
*
|
|
@@ -80,7 +86,31 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
his.setCreateTime(DateUtil.date());
|
|
|
addOlderToOrderOlder(order);
|
|
|
addChamberlainToOrder(order);
|
|
|
- addContactToOrderContact(order);
|
|
|
+ List<CareEventOrderContactStatus> contacts = addContactToOrderContact(order);
|
|
|
+ Object switchSms = redisUtil.get(RedisKeyConstant.SWITCH_SMS);
|
|
|
+ if (switchSms != null){
|
|
|
+ //给联系人发送短信
|
|
|
+ if (CollUtil.isNotEmpty(contacts)){
|
|
|
+ CareHouse house = this.careHouseService.getById(order.getHouseId());
|
|
|
+ contacts.forEach(item ->{
|
|
|
+ boolean smsResult = smsSendService.sendSmsToLianxiren(item.getContactPhone(),house.getName());
|
|
|
+ if (smsResult){
|
|
|
+ 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(his);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
this.careEventOrderHandleHisService.save(his);
|
|
|
return true;
|
|
|
}
|
|
@@ -143,10 +173,10 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
* 将紧急联系人加入到联系人当中
|
|
|
* @param order
|
|
|
*/
|
|
|
- private void addContactToOrderContact(CareEventOrder order){
|
|
|
+ private List<CareEventOrderContactStatus> addContactToOrderContact(CareEventOrder order){
|
|
|
+ List<CareEventOrderContactStatus> orderContactList = Lists.newArrayList();
|
|
|
List<CareHouseContact> cons = this.careHouseContactService.queryContactByHouseId(order.getHouseId());
|
|
|
if (CollUtil.isNotEmpty(cons)){
|
|
|
- List<CareEventOrderContactStatus> orderContactList = Lists.newArrayList();
|
|
|
cons.forEach(item ->{
|
|
|
CareEventOrderContactStatus orderContactStatus = new CareEventOrderContactStatus();
|
|
|
orderContactStatus.setOrgId(order.getOrgId());
|
|
@@ -168,5 +198,6 @@ public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper,
|
|
|
});
|
|
|
this.careEventOrderContactStatusService.saveBatch(orderContactList);
|
|
|
}
|
|
|
+ return orderContactList;
|
|
|
}
|
|
|
}
|