feat: 公田改用api调用查询接口

dev
huangfeng 11 months ago
parent 17a9231895
commit 6e95543cfe

@ -64,7 +64,7 @@ public class SmsAdapter {
result.setData(obj); result.setData(obj);
} else if (Constants.NetType_Rabchaser.equals(type)) { } else if (Constants.NetType_Rabchaser.equals(type)) {
net = "rabchaser"; net = "rabchaser";
Object obj = rabchaserWeb.listSms(iccid, today); Object obj = rabchaserApi.listSms(iccid, today);
result.setData(obj); result.setData(obj);
} else if (Constants.NetType_M2M10086.equals(type)) { } else if (Constants.NetType_M2M10086.equals(type)) {
net = "m2m10086"; net = "m2m10086";

@ -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());
}
}
} }

@ -52,7 +52,7 @@ public class RabchaserWeb {
} }
} }
@PostConstruct // @PostConstruct
private void login() { private void login() {
String url = "/user/login"; String url = "/user/login";
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();

Loading…
Cancel
Save