admin
2024-07-01 768498719683f85e5ed19c73eb3d14cdbf420df4
jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java
@@ -2,20 +2,29 @@
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
public class RestfulService {
    public static void main(String[] args) {
        String str = "uuuuuu11uuuuuuuuuuuuuuu";
        System.out.println(str.length());
        String json = "{\"code\":\"success\",\"data\":{\"productNum\":\"LCV123456P0600036\",\"stationCode\":\"1HZ01\",\"resultCode\":\"S\",\"resultText\":\"报工成功\"},\"message\":\"API 调用成功\"}";
        JSONObject jsonObject = new JSONObject(json);
        String code = jsonObject.getStr("code");
        String resultCode = jsonObject.getJSONObject("data").getStr("resultCode");
        System.out.println("code: " + code);
        System.out.println("resultCode: " + resultCode);
    }
    public static final String getRealmName = "https://imes-test-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration";
    public static final String getRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration";
//
    public static final String postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface";
    public static final String siteCode = "9786";
//    public static final String getRealmName = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration";
//    public static final String postRealmName = "https://imes-group.geelycv.com/api/mom-open/restful/interface";
    public static final String siteCode = "3983";
    /**
     * 生产工单请求接口
@@ -42,10 +51,19 @@
    //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"}
    public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime)
    {
        String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime;
        HttpResponse response = HttpRequest.get(url).execute();
        HttpRequest httpRequest = HttpRequest.get(url);
        return response.body();
        String result = "";
        try {
            String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime;
            HttpResponse response = HttpRequest.get(url).execute();
            HttpRequest httpRequest = HttpRequest.get(url);
            result =  response.body();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            return result;
        }
    }
    /**