46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
package cn.com.tenlion.smssender.service;
|
|
|
|
import cn.com.tenlion.smssender.dao.ISmsDao;
|
|
import cn.com.tenlion.smssender.enums.SmsSendStatus;
|
|
import cn.com.tenlion.smssender.pojo.HuaChuangSmsSendResult;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.format.DateTimeFormat;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @ClassName: BaseSmsSendService
|
|
* @Description:
|
|
* @Author: wanggeng
|
|
* @Date: 2022/12/7 15:18
|
|
* @Version: 1.0
|
|
*/
|
|
public class BaseSmsSendService {
|
|
|
|
/**
|
|
* 修改状态
|
|
*
|
|
* @param smsDao
|
|
* @param shortMessageNo
|
|
* @param exNo
|
|
* @param sendResult
|
|
*/
|
|
protected void updateStatus(ISmsDao smsDao, String shortMessageNo, String exNo, HuaChuangSmsSendResult sendResult) {
|
|
String shortMessageTime = DateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));
|
|
for (HuaChuangSmsSendResult.PhoneResult phoneResult : sendResult.getList()) {
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("shortMessageUid", phoneResult.getMid());
|
|
params.put("shortMessageStatus", sendResult.getStatus() == 0 ? SmsSendStatus.SEND.getValue() : SmsSendStatus.ERROR.getValue());
|
|
params.put("shortMessageTime", shortMessageTime);
|
|
params.put("shortMessageRemark", sendResult.getMessage());
|
|
|
|
params.put("shortMessagePhone", phoneResult.getMobile());
|
|
params.put("shortMessageNo", shortMessageNo);
|
|
params.put("shortMessageExno", exNo);
|
|
smsDao.updateStatus(params);
|
|
}
|
|
}
|
|
|
|
}
|