新增短信编辑和重新发送短信接口
This commit is contained in:
+11
@@ -21,4 +21,15 @@ public interface SmsRecordMapper {
|
||||
int batchSaveSmsSendRecord(@Param("list") List<SmsSendRecord> smsSendRecordList);
|
||||
SmsSendRecord selectBySId(@Param("sid") String sid);
|
||||
void updateStatus (SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 更新短信发送内容
|
||||
* @param smsSendRecord
|
||||
* @return
|
||||
*/
|
||||
int updateSendContent(SmsSendRecord smsSendRecord);
|
||||
/**
|
||||
* 通过id查询短信发送记录
|
||||
*/
|
||||
SmsSendRecord selectById(@Param("id") Long id);
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
|
||||
public interface ShortMessageService {
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*/
|
||||
void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord);
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.sendrecord.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.SMSStatusEnum;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.system.domain.entity.shortmessage.MsSmsSendHistoryRecord;
|
||||
import com.ruoyi.system.mapper.shortmessage.MsSmsSendHistoryRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.service.sendrecord.ShortMessageService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ShortMessageServiceImpl implements ShortMessageService {
|
||||
@Autowired
|
||||
MsSmsSendHistoryRecordMapper msSmsSendHistoryRecordMapper;
|
||||
/**
|
||||
* 新增发送历史记录
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public void insertShortMessageHistoryRecord(SmsSendRecord smsSendRecord) {
|
||||
if(smsSendRecord!=null){
|
||||
MsSmsSendHistoryRecord historyRecord=new MsSmsSendHistoryRecord();
|
||||
BeanUtils.copyProperties(smsSendRecord,historyRecord);
|
||||
historyRecord.setId(null);
|
||||
historyRecord.setParentId(smsSendRecord.getId());
|
||||
msSmsSendHistoryRecordMapper.insert(historyRecord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新发送短信
|
||||
*
|
||||
* @param smsSendRecord
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult reSendShortMessage(SmsSendRecord smsSendRecord) {
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
//TODO 模版id待替换
|
||||
request.setTemplateId("1955047");
|
||||
request.setPhone(smsSendRecord.getPhone());
|
||||
request.setTemplateParamSet(new String[]{ smsSendRecord.getSendContent()});
|
||||
JSONObject resultObj = SmsUtils.sendSms(request);
|
||||
if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){
|
||||
return AjaxResult.success("短信发送成功");
|
||||
}else {
|
||||
return AjaxResult.warn("短信发送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user