提交修改

dev-discount
袁野 4 years ago
parent f3bf9f4dac
commit f11f249f80
  1. 16
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  2. 41
      hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java

@ -17,6 +17,7 @@ import com.hai.model.ResponseData;
import com.hai.model.WxSharingOrderRequestModel;
import com.hai.model.WxSharingReceiversVO;
import com.hai.service.HighProfitSharingRecordService;
import com.hai.service.TelApiService;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayRecordService;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
@ -68,6 +69,8 @@ public class WechatPayController {
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private TelApiService telApiService;
@Resource
private HighProfitSharingRecordService highProfitSharingRecordService;
@ -176,6 +179,17 @@ public class WechatPayController {
+ body + "\n";
}
@RequestMapping(value = "/telApi", method = RequestMethod.GET)
@ApiOperation(value = "电话查询")
@ResponseBody
public ResponseData addLedgerReceiver(@RequestParam(value = "tel", required = true) String tel) {
try {
JSONObject jsonObject = telApiService.outApiTel(tel);
return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -126,6 +126,47 @@ public class HttpsUtils {
return null;
}
public static JSONObject doGet(String url, Map<String, String> params , Map<String , String> headers) {
String apiUrl = url;
StringBuffer param = new StringBuffer();
int i = 0;
for (String key : params.keySet()) {
if (i == 0)
param.append("?");
else
param.append("&");
param.append(key).append("=").append(params.get(key));
i++;
}
apiUrl += param;
String result = null;
HttpClient httpClient = null;
try {
if (apiUrl.startsWith("https")) {
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory())
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build();
} else {
httpClient = HttpClients.createDefault();
}
HttpGet httpGet = new HttpGet(apiUrl);
for (Map.Entry<String, String> e : headers.entrySet()) {
httpGet.addHeader(e.getKey(), e.getValue());
}
HttpResponse response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
result = IOUtils.toString(instream, "UTF-8");
}
return JSON.parseObject(result);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
return null;
}
public static JSONObject doWxGet(String url, Map<String, Object> params) {
String apiUrl = url;
StringBuffer param = new StringBuffer();

Loading…
Cancel
Save