|
|
@ -3,6 +3,7 @@ package com.shxy.xymanager_common.sms.rabchaser;
|
|
|
|
import com.shxy.xymanager_common.exception.ApiException;
|
|
|
|
import com.shxy.xymanager_common.exception.ApiException;
|
|
|
|
import com.shxy.xymanager_common.util.DigestUtils;
|
|
|
|
import com.shxy.xymanager_common.util.DigestUtils;
|
|
|
|
import com.shxy.xymanager_common.util.HttpClient;
|
|
|
|
import com.shxy.xymanager_common.util.HttpClient;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.util.JSONUtil;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -50,4 +51,38 @@ public class RabchaserApi {
|
|
|
|
throw new ApiException("发送短信异常," + e.getMessage());
|
|
|
|
throw new ApiException("发送短信异常," + e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Object listSms(String iccid, String date) {
|
|
|
|
|
|
|
|
String url = "/simCards/getSmsReceiveRecord";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
|
|
|
|
dataMap.put("iccid", iccid);
|
|
|
|
|
|
|
|
// dataMap.put("receiveTime", date);
|
|
|
|
|
|
|
|
dataMap.put("pageNum", 1);
|
|
|
|
|
|
|
|
dataMap.put("pageSize", 10);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Map<String, String> headMap = this.signHead(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> result = null;
|
|
|
|
|
|
|
|
String json = HttpClient.post(baseUrl + url, dataMap, headMap);
|
|
|
|
|
|
|
|
log.info("查询短信记录完成: " + json);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
result = JSONUtil.json2Object(json, HashMap.class);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new ApiException(json);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.get("code") != null && "200".equalsIgnoreCase(result.get("code").toString())) {
|
|
|
|
|
|
|
|
return result.get("result");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String error = String.valueOf(result.get("message"));
|
|
|
|
|
|
|
|
throw new ApiException(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (ApiException e) {
|
|
|
|
|
|
|
|
throw e;
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("查询短信记录异常.", e);
|
|
|
|
|
|
|
|
throw new ApiException("查询短信记录异常," + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|