Browse Source

修改推送炼钢出坯量接口为get请求

lingpeng.li 5 days ago
parent
commit
10c7317d29

+ 16 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/service/impl/BilletOriginalProductRecordServiceImpl.java

@@ -33,6 +33,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -514,7 +515,7 @@ public class BilletOriginalProductRecordServiceImpl extends ServiceImpl<BilletOr
             // 打印请求参数
             log.info("远程推送炼钢一体化出坯量成功! 请求参数: {}", JSON.toJSONString(pushDTO));
         } else {
-            log.error("远程推送炼钢一体化出坯量成功! 请求参数: {}", JSON.toJSONString(pushDTO));
+            log.error("远程推送炼钢一体化出坯量失败! 请求参数: {}", JSON.toJSONString(pushDTO));
             throw new RuntimeException("远程调用装运单接收接口失败!");
         }
 
@@ -528,11 +529,21 @@ public class BilletOriginalProductRecordServiceImpl extends ServiceImpl<BilletOr
         int attempt = 0;
         while (attempt < maxRetries) {
             try {
-                String url = "http://192.168.12.201:8850/scheduling/api/billet-quantities/handleBillet";
-                ResponseEntity<BilletPushResponse> response = restTemplate.postForEntity(url, request, BilletPushResponse.class);
+                String baseUrl = "http://192.168.12.201:8850/scheduling/api/billet-quantities/handleBillet";
+
+                // 拼接 GET 请求参数
+                UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl)
+                        .queryParam("ccNo", request.getCcNo())
+                        .queryParam("heatNo", request.getHeatNo())
+                        .queryParam("billetWt", request.getBilletWt());
+
+                String fullUrl = builder.toUriString();
+                log.info("开始推送炼钢出坯量接口,请求URL: {}", fullUrl);
+
+                ResponseEntity<BilletPushResponse> response = restTemplate.getForEntity(builder.toUriString(), BilletPushResponse.class);
 
                 BilletPushResponse body = response.getBody();
-//                log.info("推送成功,响应信息: {}", body);
+                log.info("推送成功,响应状态码: {}, 响应内容: {}", response.getStatusCode(), JSON.toJSONString(body));
 
                 return body;
             } catch (Exception e) {
@@ -554,6 +565,7 @@ public class BilletOriginalProductRecordServiceImpl extends ServiceImpl<BilletOr
         return null;
     }
 
+
     public QualityInspectionStatisticsVO getStatisticsByShift(BilletHotsendChangeShift shiftRecord, List<BilletHotsendChangeShift> allShiftsOfTheDay,Map<LocalDate, List<BilletHotsendChangeShift>> shiftByDate) {
         Date classStartTime = shiftRecord.getCreateTime();
         Date classEndTime = Optional.ofNullable(shiftRecord.getChangeShiftTime()).orElse(new Date());