|
|
@@ -2,6 +2,7 @@ package com.zd.laboratory.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zd.common.core.redis.RedisService;
|
|
|
+import com.zd.laboratory.api.constant.SmsMessageConstants;
|
|
|
import com.zd.laboratory.api.vo.TextMessageVo;
|
|
|
import com.zd.laboratory.config.MessagePropertiesConfig;
|
|
|
import com.zd.laboratory.service.ILabMessageService;
|
|
|
@@ -12,8 +13,6 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* @Author donggaosheng
|
|
|
* @Date 2024-02-21
|
|
|
@@ -32,40 +31,29 @@ public class LabMessageServiceImpl implements ILabMessageService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject sendMessageTemp(TextMessageVo textMessageBo) {
|
|
|
- JSONObject jsonObject= TextMessageUtils.sendSimpleMessageTemp(messagePropertiesConfig.getUserName(),messagePropertiesConfig.getPassWord(),messagePropertiesConfig.getSignature(),messagePropertiesConfig.getAgentId(),messagePropertiesConfig.getTempContent(),textMessageBo.getPhoneList(),textMessageBo.getVariableList());
|
|
|
- boolean state = Boolean.FALSE;
|
|
|
+ JSONObject jsonObject= TextMessageUtils.sendSimpleMessageTemp(messagePropertiesConfig.getUserName(),messagePropertiesConfig.getPassWord(),messagePropertiesConfig.getSignature(),textMessageBo.getTempId(),textMessageBo.getTempContent(),textMessageBo.getPhoneList(),textMessageBo.getVariableList());
|
|
|
if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
|
|
|
- state = Boolean.TRUE;
|
|
|
JSONObject redisJson=new JSONObject();
|
|
|
redisJson.put("msgId",jsonObject.getString("msgId"));
|
|
|
-// redisJson.put("title",iotAlarmTemplate.getTemplateName());
|
|
|
-// redisJson.put("receiver",iotAlarmTemplate.getReceiver());
|
|
|
- String tempContent=TextMessageUtils.getSimpleTemplateContent(messagePropertiesConfig.getUserName(),messagePropertiesConfig.getPassWord(),messagePropertiesConfig.getTempContent(),textMessageBo.getVariableList());
|
|
|
+ redisJson.put("receiver",textMessageBo.getPhoneList());
|
|
|
+ String tempContent=TextMessageUtils.getSimpleTemplateContent(messagePropertiesConfig.getUserName(),messagePropertiesConfig.getPassWord(),textMessageBo.getTempContent(),textMessageBo.getVariableList());
|
|
|
redisJson.put("content",tempContent);
|
|
|
- // redisService.setCacheObject(IotConstant.ZT_MESSAGE_KEY+jsonObject.getString("msgId"),redisJson);
|
|
|
+ redisService.setCacheObject(SmsMessageConstants.ZT_MESSAGE_KEY+jsonObject.getString("msgId"),redisJson);
|
|
|
}
|
|
|
- //添加消息日志
|
|
|
- String receiver = textMessageBo.getPhoneList().toString();
|
|
|
- //iotAlarmLogService.addAlarmMessageLog(AlarmTypeEnum.Type.SMS, receiver, null, iotAlarmTemplate.getContent(), null, state, !state ? jsonObject.toJSONString() : null);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject sendMessageVoice(TextMessageVo textMessageBo) {
|
|
|
JSONObject jsonObject=TextMessageUtils.sendMessageVoice(messagePropertiesConfig.getUserName(),messagePropertiesConfig.getPassWord(),textMessageBo.getTempContent(),textMessageBo.getPhoneList());
|
|
|
- boolean state = Boolean.FALSE;
|
|
|
if(jsonObject.getIntValue("code")== HttpStatus.SC_OK){
|
|
|
- state = Boolean.TRUE;
|
|
|
String msgId=jsonObject.getJSONObject("data").getString("msgId");
|
|
|
JSONObject object=new JSONObject();
|
|
|
object.put("receiver",textMessageBo.getPhoneList());
|
|
|
object.put("content",textMessageBo.getTempContent());
|
|
|
object.put("msgId",msgId);
|
|
|
- //redisService.setCacheObject(IotConstant.ZT_VOICE_KEY+msgId,object);
|
|
|
+ redisService.setCacheObject(SmsMessageConstants.ZT_VOICE_KEY+msgId,object);
|
|
|
}
|
|
|
- //添加消息日志
|
|
|
- // String receiver = textMessageBo.getPhoneList().toString();
|
|
|
- //iotAlarmLogService.addAlarmMessageLog(AlarmTypeEnum.Type.PHONE, receiver, null, textMessageBo.getTempContent(), null, state, !state ? jsonObject.toJSONString() : null);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|