From 748302fcde39ae1caffafa463225fbb9eac06620 Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Thu, 13 Jun 2024 10:41:12 +0800 Subject: [PATCH] '123' --- .../web/controller/quot/QuotController.java | 23 +++- .../ruoyi/common/utils/http/HttpUtils.java | 100 +++++++++++++++++- .../main/java/com/ruoyi/quot/domain/Quot.java | 6 ++ .../quot/domain/jsw/QuotJswUserResult.java | 5 + .../mapper/priceVerification/QuotHjMapper.xml | 3 +- .../main/resources/mapper/quot/QuotMapper.xml | 10 +- .../technicalConfirm/QuotJsqrMapper.xml | 2 +- .../priceVerification/index.vue | 10 ++ ruoyi-ui/src/views/quot/quot/index.vue | 16 ++- 9 files changed, 159 insertions(+), 16 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java index 1979a5c..a31d231 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java @@ -308,6 +308,7 @@ public class QuotController extends BaseController String roleKey = sysRole.getRoleKey(); if("PRICE_VERIFICATION".equals(roleKey)){ hjRoleFlag = true; + break; } } if(!hjRoleFlag){ @@ -482,14 +483,26 @@ public class QuotController extends BaseController { String quotJswApprovalStatus = quot.getQuotJswApprovalStatus(); if("2".equals(quotJswApprovalStatus)){//重新调点 - String quotJswCode = quot.getQuotJswCode(); - String returnTdJson = "{\"bjdid\":"+quotJswCode+"}"; - Map res = HttpUtils.sendPostJson("http://price.jncable.com.cn:7778/GTHINKING/AjaxService/U20231485_N_XLXSBJ/100860101.ashx/DispatchBJD",returnTdJson,""); - String returnTdResultJson = res.get("res"); - QuotJswUserResult quotJswUserResult = JSON.parseObject(returnTdResultJson, QuotJswUserResult.class); + //==============================账户认证================================== + QuotJswUser quotJswUser = new QuotJswUser("JNBJPT","1q2w3e","S",""); + String quotJswUserJson = JSON.toJSONString(quotJswUser); + Map res = HttpUtils.sendPostJson("http://price.jncable.com.cn:7778/GTHINKING/AjaxService/N_MISPRO/100208057.ashx/Login",quotJswUserJson,""); + String cookie = res.get("cookie"); + System.out.println("cookie======"+cookie); + String QuotJswUserResultJson = res.get("res"); + QuotJswUserResult quotJswUserResult = JSON.parseObject(QuotJswUserResultJson, QuotJswUserResult.class); if(!quotJswUserResult.getSuccess()){ return error(quotJswUserResult.getErrorMessage()); } + + String quotJswCode = quot.getQuotJswCode(); + String returnTdJson = "{\"bjdid\":\""+quotJswCode+"\"}"; + Map res2 = HttpUtils.sendPostJson("http://price.jncable.com.cn:7778/GTHINKING/AjaxService/U20231485_N_XLXSBJ/100860101.ashx/DispatchBJD",returnTdJson,cookie); + String returnTdResultJson = res2.get("res"); + QuotJswUserResult quotJswUserResult2 = JSON.parseObject(returnTdResultJson, QuotJswUserResult.class); + if(!quotJswUserResult2.getSuccess()){ + return error(quotJswUserResult2.getMessage()); + } }else{ // ==============================对接金思维接口============================== //==============================账户认证================================== diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java index 671aefa..425ff51 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java @@ -193,7 +193,7 @@ public class HttpUtils } /** - * 向指定 URL 发送POST方法的请求 + * 向指定 URL 发送POST方法的请求 - 金思维对接用 * * @param url 发送请求的 URL * @param param 请求参数,请求参数应该是 json字符串 的形式。 @@ -221,8 +221,29 @@ public class HttpUtils conn.setRequestProperty("Content-Type", "application/json"); // 设置Cookie头部 if(StringUtils.isNotEmpty(cookie)){ - conn.setRequestProperty("Cookies", "cookie="+cookie); + String cookies[] = cookie.split("; "); + String cookieString = ""; + for(String c:cookies){ + String v[]= c.split("="); + if(".ASPXAUTH".equals(v[0])){ + if(StringUtils.isEmpty(cookieString)){ + cookieString = v[0] + "=" +v[1] +"; "; + }else{ + cookieString = cookieString + v[0] + "=" +v[1] +"; "; + } + }else if("uid".equals(v[0])){ + if(StringUtils.isEmpty(cookieString)){ + cookieString = v[0] + "=" +v[1] +"; "; + }else{ + cookieString = cookieString + v[0] + "=" +v[1] +"; "; + } + }else{ + continue; + } + } + conn.setRequestProperty("Cookie", cookieString); } + conn.setDoOutput(true); conn.setDoInput(true); out = new PrintWriter(conn.getOutputStream()); @@ -280,6 +301,81 @@ public class HttpUtils return map; } + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 json字符串 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPostJson2(String url, String param) + { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try + { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "application/json"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + if (in != null) + { + in.close(); + } + } + catch (IOException ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + public static String sendSSLPost(String url, String param) { StringBuilder result = new StringBuilder(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java index 8bd3771..d6b3daa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java @@ -82,6 +82,9 @@ public class Quot extends BaseEntity /** 反馈说明 */ private String quotFeedbackExplanation; + /** 明细条数 */ + private Integer quotMaterialsCount; + /** 铝价 */ private String quotLvPrice; @@ -288,6 +291,9 @@ public class Quot extends BaseEntity { return quotFeedbackExplanation; } + public Integer getQuotMaterialsCount() { return quotMaterialsCount; } + + public void setQuotMaterialsCount(Integer quotMaterialsCount) { this.quotMaterialsCount = quotMaterialsCount; } public String getQuotLvPrice() { return quotLvPrice; } public void setQuotLvPrice(String quotLvPrice) { this.quotLvPrice = quotLvPrice; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswUserResult.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswUserResult.java index 75dffb3..824f2fe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswUserResult.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/jsw/QuotJswUserResult.java @@ -6,6 +6,7 @@ package com.ruoyi.quot.domain.jsw; public class QuotJswUserResult { private Boolean Success; private String ErrorMessage; + private String Message; public Boolean getSuccess() { return Success; @@ -22,4 +23,8 @@ public class QuotJswUserResult { public void setErrorMessage(String errorMessage) { ErrorMessage = errorMessage; } + + public String getMessage() { return Message; } + + public void setMessage(String message) { Message = message; } } diff --git a/ruoyi-system/src/main/resources/mapper/priceVerification/QuotHjMapper.xml b/ruoyi-system/src/main/resources/mapper/priceVerification/QuotHjMapper.xml index dcc488d..85e2be4 100644 --- a/ruoyi-system/src/main/resources/mapper/priceVerification/QuotHjMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/priceVerification/QuotHjMapper.xml @@ -63,10 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and quot_hj_code like concat('%', #{quotHjCode}, '%') and quot_hj_pricing_date between #{params.beginQuotHjPricingDate} and #{params.endQuotHjPricingDate} + and q.quot_hj_approval_status = #{quotHjApprovalStatus} - order by a.update_time desc + order by a.quot_hj_code desc