|
|
@@ -29,6 +29,7 @@ import com.zd.system.api.RemoteUserService;
|
|
|
import com.zd.system.api.alarm.RemoteAlarmService;
|
|
|
import com.zd.system.api.alarm.domain.AlarmEntrty;
|
|
|
import com.zd.system.api.alarm.domain.Routes;
|
|
|
+import com.zd.system.api.chemical.RemoteStockService;
|
|
|
import com.zd.system.api.laboratory.domain.LabMessageContent;
|
|
|
import com.zd.system.api.laboratory.domain.SubAddrr;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
@@ -37,6 +38,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -84,6 +86,12 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
|
|
|
@Autowired
|
|
|
private LabContentMachineMsgMapper labContentMachineMsgMapper;
|
|
|
|
|
|
+ @Value("${phoneMode:0}")
|
|
|
+ public static Integer phoneMode;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ RemoteStockService remoteStockService;
|
|
|
+
|
|
|
|
|
|
private final String smsFormat="{}: {},发生风险预案,{}";
|
|
|
/**
|
|
|
@@ -225,49 +233,54 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
|
|
|
|
|
|
logger.info("%%%%%%%%%%%%%%%%%%%%strings:"+strings);
|
|
|
//todo 发送最多支持200个电话号码 , 这里不会超过200人 所以没有验证, 切割
|
|
|
- if(strings!=null)
|
|
|
- {
|
|
|
- AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush,strings,format);
|
|
|
- MessageBody messageBody = new MessageBody();
|
|
|
- messageBody.setData(alarmEntrty);
|
|
|
- commonSend.send("alarm/"+newRiskPlan.getId()+"/"+subject.getId(),messageBody, SendMode.DISTINCT);
|
|
|
- logger.info("&&&&"+"alarm/"+newRiskPlan.getId()+"/"+subject.getId());
|
|
|
- logger.info("&&&&"+JSON.toJSONString(messageBody));
|
|
|
+ //todo 这里判断电话类型,如果是0,发送短信,如果是1,是四医大内部短信接口。
|
|
|
+ if(phoneMode == 0){
|
|
|
+ if(strings!=null)
|
|
|
+ {
|
|
|
+ AlarmEntrty alarmEntrty = new AlarmEntrty(Routes.NoticePush,strings,format);
|
|
|
+ MessageBody messageBody = new MessageBody();
|
|
|
+ messageBody.setData(alarmEntrty);
|
|
|
+ commonSend.send("alarm/"+newRiskPlan.getId()+"/"+subject.getId(),messageBody, SendMode.DISTINCT);
|
|
|
+ logger.info("&&&&"+"alarm/"+newRiskPlan.getId()+"/"+subject.getId());
|
|
|
+ logger.info("&&&&"+JSON.toJSONString(messageBody));
|
|
|
// 改用mqtt
|
|
|
// AjaxResult send = remoteAlarmService.send(alarmEntrty);
|
|
|
- try {
|
|
|
- if(subject.getAdminId()!=null)
|
|
|
- {
|
|
|
- //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message
|
|
|
- labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),subject.getAdminId().toString(),groupId,newRiskPlan, WarnUserAttrEnum.ADMIN);
|
|
|
+ try {
|
|
|
+ if(subject.getAdminId()!=null)
|
|
|
+ {
|
|
|
+ //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message
|
|
|
+ labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),subject.getAdminId().toString(),groupId,newRiskPlan, WarnUserAttrEnum.ADMIN);
|
|
|
+ }
|
|
|
+ //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message 保持实验室内部人员发送记录 ?安全的要不要保存展示?
|
|
|
+ labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),userids,groupId,newRiskPlan, WarnUserAttrEnum.NONE);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("发送预案消息失败!");
|
|
|
}
|
|
|
- //发送预案消息(预案指挥中心) 没什么卵用 lab_warn_push_message 保持实验室内部人员发送记录 ?安全的要不要保存展示?
|
|
|
- labWarnPushMessageService.insertLabWarnPushMessage(subject.getId(),userids,groupId,newRiskPlan, WarnUserAttrEnum.NONE);
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("发送预案消息失败!");
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //发送消息
|
|
|
- if(StrUtil.isNotBlank(newRiskPlan.getInformation()))
|
|
|
- {
|
|
|
- String collect = Stream.of(new String[]{subject.getAdminId()==null?null:subject.getAdminId().toString(), subject.getSafeUserId()})
|
|
|
- .filter(a -> StrUtil.isNotBlank(a))
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- if(StrUtil.isNotBlank(collect))
|
|
|
+ //发送消息
|
|
|
+ if(StrUtil.isNotBlank(newRiskPlan.getInformation()))
|
|
|
{
|
|
|
- LabMessageContentDTO labMessageContentDTO = new LabMessageContentDTO();
|
|
|
- labMessageContentDTO.setUserIds(collect);
|
|
|
- labMessageContentDTO.setSendMode(2);
|
|
|
- labMessageContentDTO.setSendRange(3);
|
|
|
- labMessageContentDTO.setContent(newRiskPlan.getMessage());
|
|
|
- labMessageContentDTO.setUserId(-2L);
|
|
|
- sendMessageWarn(labMessageContentDTO);
|
|
|
- }
|
|
|
+ String collect = Stream.of(new String[]{subject.getAdminId()==null?null:subject.getAdminId().toString(), subject.getSafeUserId()})
|
|
|
+ .filter(a -> StrUtil.isNotBlank(a))
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ if(StrUtil.isNotBlank(collect))
|
|
|
+ {
|
|
|
+ LabMessageContentDTO labMessageContentDTO = new LabMessageContentDTO();
|
|
|
+ labMessageContentDTO.setUserIds(collect);
|
|
|
+ labMessageContentDTO.setSendMode(2);
|
|
|
+ labMessageContentDTO.setSendRange(3);
|
|
|
+ labMessageContentDTO.setContent(newRiskPlan.getMessage());
|
|
|
+ labMessageContentDTO.setUserId(-2L);
|
|
|
+ sendMessageWarn(labMessageContentDTO);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }else if(phoneMode == 1){
|
|
|
+ //走四医大发送短信服务接口
|
|
|
+ remoteStockService.sendSydSms(newRiskPlan.getMessage(),5,null,strings);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private String getDoingUserId(LabSubjectVO subject) {
|