记得上下班打卡 | git大法好,push需谨慎

Commit 6c4759e7 authored by 胡佳晨's avatar 胡佳晨

修改 httpClient request

parent 18fe0cc9
...@@ -138,16 +138,24 @@ public class HttpUtil { ...@@ -138,16 +138,24 @@ public class HttpUtil {
if (url == null || url.trim().isEmpty()) { if (url == null || url.trim().isEmpty()) {
return null; return null;
} }
HttpEntity<Object> httpEntity;
if (headers != null) {
// header // header
HttpHeaders httpHeaders = new HttpHeaders(); HttpHeaders httpHeaders = new HttpHeaders();
if (headers != null) {
httpHeaders.addAll(headers); httpHeaders.addAll(headers);
httpHeaders.setContentType(mediaType);
httpEntity = new HttpEntity(params, httpHeaders);
} else {
httpEntity = new HttpEntity(params, null);
} }
HttpEntity<Object> httpEntity = new HttpEntity(params, httpHeaders);
// HttpEntity<Object> httpEntity;
// if (headers != null) {
// // header
// HttpHeaders httpHeaders = new HttpHeaders();
// httpHeaders.addAll(headers);
// httpHeaders.setContentType(mediaType);
// httpEntity = new HttpEntity(params, httpHeaders);
// } else {
// httpEntity = new HttpEntity(params, null);
// }
// 提交方式:表单、json // 提交方式:表单、json
ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class); ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
return response.getBody(); return response.getBody();
......
...@@ -311,6 +311,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -311,6 +311,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
return resultData; return resultData;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
log.error("Kylin Order Pay Error = " + e.getMessage());
if (isDownGeneral) { if (isDownGeneral) {
currentTime = System.currentTimeMillis(); currentTime = System.currentTimeMillis();
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
...@@ -326,8 +328,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -326,8 +328,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} }
} }
} }
e.printStackTrace();
log.error("Kylin Order Pay Error = " + e.getMessage());
redisLockUtil.unlock(lock); redisLockUtil.unlock(lock);
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常 return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment