diff --git a/viewsh-module-ops/viewsh-module-ops-biz/src/main/java/com/viewsh/module/ops/infrastructure/vsp/VspNotifyClientImpl.java b/viewsh-module-ops/viewsh-module-ops-biz/src/main/java/com/viewsh/module/ops/infrastructure/vsp/VspNotifyClientImpl.java index 277051f..8cf474b 100644 --- a/viewsh-module-ops/viewsh-module-ops-biz/src/main/java/com/viewsh/module/ops/infrastructure/vsp/VspNotifyClientImpl.java +++ b/viewsh-module-ops/viewsh-module-ops-biz/src/main/java/com/viewsh/module/ops/infrastructure/vsp/VspNotifyClientImpl.java @@ -6,6 +6,9 @@ import com.viewsh.module.ops.infrastructure.vsp.dto.VspSendCardReqDTO; import com.viewsh.module.ops.infrastructure.vsp.dto.VspSyncStatusReqDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.ResourceAccessException; @@ -44,9 +47,13 @@ public class VspNotifyClientImpl implements VspNotifyClient { private void executeWithRetry(String url, Object req, String action, String orderId, String alarmId) { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity entity = new HttpEntity<>(req, headers); + for (int i = 0; i <= properties.getMaxRetry(); i++) { try { - VspResponseDTO resp = restTemplate.postForObject(url, req, VspResponseDTO.class); + VspResponseDTO resp = restTemplate.postForObject(url, entity, VspResponseDTO.class); if (resp != null && resp.isSuccess()) { log.info("[{}] vsp通知成功, orderId={}, alarmId={}", action, orderId, alarmId); return;