编码调整为GBK
This commit is contained in:
parent
24c8292710
commit
8d2d27c7cd
|
@ -40,8 +40,8 @@ import java.util.*;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务-回写bip合同销售订单字段
|
* 定时任务-回写bip合同销售订单字段
|
||||||
* 2005适配2312
|
* 2005适配2312
|
||||||
*
|
*
|
||||||
* @author mzr
|
* @author mzr
|
||||||
* @date 2025/3/26
|
* @date 2025/3/26
|
||||||
|
@ -63,7 +63,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查bip参数是否完整
|
* 检查bip参数是否完整
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +115,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String invoiceReceiveUrl = bipParamMap.get("contractSaleOrder");// 开票申请单回传
|
String invoiceReceiveUrl = bipParamMap.get("contractSaleOrder");// 开票申请单回传
|
||||||
if (StringUtils.isEmpty(invoiceReceiveUrl)) {
|
if (StringUtils.isEmpty(invoiceReceiveUrl)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
|
||||||
// 获取未推送合同销售订单更新的销售发票信息;
|
// 获取未推送合同销售订单更新的销售发票信息;
|
||||||
String sql = " select so_saleinvoice_b.cfirstbid,csaleinvoicebid from so_saleinvoice,so_saleinvoice_b where so_saleinvoice.csaleinvoiceid=so_saleinvoice_b.csaleinvoiceid and so_saleinvoice.fstatusflag=2 and nvl(so_saleinvoice_b.vbdef10,'N') in ('~','N') and nvl(so_saleinvoice.vdef13,'~') not in ('~') ";
|
String sql = " select so_saleinvoice_b.cfirstbid,csaleinvoicebid from so_saleinvoice,so_saleinvoice_b where so_saleinvoice.csaleinvoiceid=so_saleinvoice_b.csaleinvoiceid and so_saleinvoice.fstatusflag=2 and nvl(so_saleinvoice_b.vbdef10,'N') in ('~','N') and nvl(so_saleinvoice.vdef13,'~') not in ('~') ";
|
||||||
|
|
||||||
List<Map<String, String>> l_pk = (List<Map<String, String>>) new BaseDAO().executeQuery(sql.toString(), new MapListProcessor());
|
List<Map<String, String>> l_pk = (List<Map<String, String>>) new BaseDAO().executeQuery(sql.toString(), new MapListProcessor());
|
||||||
|
@ -162,16 +162,16 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
if (accessToken != "") {
|
if (accessToken != "") {
|
||||||
JSONObject js_apct_detail = new JSONObject();
|
JSONObject js_apct_detail = new JSONObject();
|
||||||
JSONObject js_apct = new JSONObject();
|
JSONObject js_apct = new JSONObject();
|
||||||
String hid = ll_saleorder.get(0).get("vdef9");// BIP合同销售订单更新 主表id
|
String hid = ll_saleorder.get(0).get("vdef9");// BIP合同销售订单更新 主表id
|
||||||
List<Map<String, Object>> l_map_f = new ArrayList<Map<String, Object>>();
|
List<Map<String, Object>> l_map_f = new ArrayList<Map<String, Object>>();
|
||||||
for (Map<String, String> custpkmap : ll_saleorder) {
|
for (Map<String, String> custpkmap : ll_saleorder) {
|
||||||
|
|
||||||
Map<String, Object> b_map = new HashMap<String, Object>();
|
Map<String, Object> b_map = new HashMap<String, Object>();
|
||||||
|
|
||||||
b_map.put("id", custpkmap.get("vbdef11"));// BIP合同销售订单更新 子表id
|
b_map.put("id", custpkmap.get("vbdef11"));// BIP合同销售订单更新 子表id
|
||||||
b_map.put("billQty", custpkmap.get("billqty"));// 累计开票主数量
|
b_map.put("billQty", custpkmap.get("billqty"));// 累计开票主数量
|
||||||
b_map.put("totalAccrued", custpkmap.get("totalaccrued"));// 累计确认应收金额
|
b_map.put("totalAccrued", custpkmap.get("totalaccrued"));// 累计确认应收金额
|
||||||
b_map.put("totalOutQty", custpkmap.get("totaloutqty"));// 累计出库主数量
|
b_map.put("totalOutQty", custpkmap.get("totaloutqty"));// 累计出库主数量
|
||||||
|
|
||||||
l_map_f.add(b_map);
|
l_map_f.add(b_map);
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
String resultString = doSendHttp(custUpdateUrl, "POST", tokenParam, "", headers, js_apct_detail.toJSONString());
|
String resultString = doSendHttp(custUpdateUrl, "POST", tokenParam, "", headers, js_apct_detail.toJSONString());
|
||||||
Map updateMap = gson.fromJson(resultString, Map.class);
|
Map updateMap = gson.fromJson(resultString, Map.class);
|
||||||
String updateSql = "";
|
String updateSql = "";
|
||||||
if (StringUtils.equals("200", updateMap.get("code").toString())) {// 保存更新成功后需要更新日志表
|
if (StringUtils.equals("200", updateMap.get("code").toString())) {// 保存更新成功后需要更新日志表
|
||||||
updateSql = "update so_saleinvoice_b set vbdef10='Y' where csaleinvoiceid='" + map.get("csaleinvoicebid") + "'";
|
updateSql = "update so_saleinvoice_b set vbdef10='Y' where csaleinvoiceid='" + map.get("csaleinvoicebid") + "'";
|
||||||
} else {
|
} else {
|
||||||
updateSql = "update so_saleinvoice_b set vbdef10='N' where csaleinvoiceid='" + map.get("csaleinvoicebid") + "'";
|
updateSql = "update so_saleinvoice_b set vbdef10='N' where csaleinvoiceid='" + map.get("csaleinvoicebid") + "'";
|
||||||
|
@ -202,7 +202,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}// 获取BIP的token
|
}// 获取BIP的token
|
||||||
catch (SQLException e) {
|
catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -217,7 +217,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询bip 中开户行及银行类型id
|
* 查询bip 中开户行及银行类型id
|
||||||
*
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param bipUrl
|
* @param bipUrl
|
||||||
|
@ -233,7 +233,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
String resultString = doSendHttp(bipUrl, "POST", tokenParam, "", new HashMap<>(), jsonData);
|
String resultString = doSendHttp(bipUrl, "POST", tokenParam, "", new HashMap<>(), jsonData);
|
||||||
// Map custDetailresult = gson.fromJson(resultString, Map.class);
|
// Map custDetailresult = gson.fromJson(resultString, Map.class);
|
||||||
JSONObject custDetailresult = JSON.parseObject(resultString);
|
JSONObject custDetailresult = JSON.parseObject(resultString);
|
||||||
if (StringUtils.equals("200", custDetailresult.get("code").toString())) {// 数据存在
|
if (StringUtils.equals("200", custDetailresult.get("code").toString())) {// 数据存在
|
||||||
Map<String, Object> dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
Map<String, Object> dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
||||||
if (!MMValueCheck.isEmpty(dataInfo.get("recordList"))) {
|
if (!MMValueCheck.isEmpty(dataInfo.get("recordList"))) {
|
||||||
List<Map<String, String>> l_record = (List<Map<String, String>>) dataInfo.get("recordList");
|
List<Map<String, String>> l_record = (List<Map<String, String>>) dataInfo.get("recordList");
|
||||||
|
@ -245,7 +245,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
resultString = doSendHttp(bipUrl, "POST", tokenParam, "", new HashMap<>(), jsonData);
|
resultString = doSendHttp(bipUrl, "POST", tokenParam, "", new HashMap<>(), jsonData);
|
||||||
// custDetailresult = gson.fromJson(resultString, Map.class);
|
// custDetailresult = gson.fromJson(resultString, Map.class);
|
||||||
custDetailresult = JSON.parseObject(resultString);
|
custDetailresult = JSON.parseObject(resultString);
|
||||||
if (StringUtils.equals("200", custDetailresult.get("code").toString())) {// 数据存在
|
if (StringUtils.equals("200", custDetailresult.get("code").toString())) {// 数据存在
|
||||||
dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
||||||
if (!MMValueCheck.isEmpty(dataInfo.get("recordList"))) {
|
if (!MMValueCheck.isEmpty(dataInfo.get("recordList"))) {
|
||||||
List<Map<String, String>> l_record = (List<Map<String, String>>) dataInfo.get("recordList");
|
List<Map<String, String>> l_record = (List<Map<String, String>>) dataInfo.get("recordList");
|
||||||
|
@ -277,11 +277,11 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// log.error("uRL:" + baseUrl);
|
// log.error("uRL:" + baseUrl);
|
||||||
// // 打印请求URL和方法
|
// // 打印请求URL和方法
|
||||||
// log.error("Request URL: " + baseUrl);
|
// log.error("Request URL: " + baseUrl);
|
||||||
// log.error("Request Method: " + method);
|
// log.error("Request Method: " + method);
|
||||||
URL urlobj = new URL(baseUrl);
|
URL urlobj = new URL(baseUrl);
|
||||||
if ("https".equalsIgnoreCase(urlobj.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
if ("https".equalsIgnoreCase(urlobj.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||||
IgnoreSslUtil.ignoreSsl();
|
IgnoreSslUtil.ignoreSsl();
|
||||||
}
|
}
|
||||||
urlConnection = (HttpURLConnection) urlobj.openConnection();
|
urlConnection = (HttpURLConnection) urlobj.openConnection();
|
||||||
|
@ -289,7 +289,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
urlConnection.setRequestMethod(method);
|
urlConnection.setRequestMethod(method);
|
||||||
urlConnection.setDoInput(true);
|
urlConnection.setDoInput(true);
|
||||||
urlConnection.setUseCaches(false);
|
urlConnection.setUseCaches(false);
|
||||||
// 如果设置了自定义头,则打印它们
|
// 如果设置了自定义头,则打印它们
|
||||||
if (headers != null && !headers.isEmpty()) {
|
if (headers != null && !headers.isEmpty()) {
|
||||||
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||||
urlConnection.addRequestProperty(entry.getKey(), entry.getValue());
|
urlConnection.addRequestProperty(entry.getKey(), entry.getValue());
|
||||||
|
@ -330,7 +330,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
JSONObject js = new JSONObject();
|
JSONObject js = new JSONObject();
|
||||||
js.put("", -1);
|
js.put("", -1);
|
||||||
js.put("message", "调用外系统接口失败:" + e.getMessage());
|
js.put("message", "调用外系统接口失败:" + e.getMessage());
|
||||||
result = js.toString();
|
result = js.toString();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -363,7 +363,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
|
|
||||||
// private String createCustBankMap(Map<String,String> map,String access_token) {
|
// private String createCustBankMap(Map<String,String> map,String access_token) {
|
||||||
// Gson gson = new Gson();
|
// Gson gson = new Gson();
|
||||||
// //获取BIP中的客户详情
|
// //获取BIP中的客户详情
|
||||||
// String custcode=map.get("custcode");
|
// String custcode=map.get("custcode");
|
||||||
// String custurl=baseUrl+"/yonbip/digitalModel/merchant/detail?access_token="+access_token;
|
// String custurl=baseUrl+"/yonbip/digitalModel/merchant/detail?access_token="+access_token;
|
||||||
// HashMap<String, String> custMap = new HashMap<String, String>();
|
// HashMap<String, String> custMap = new HashMap<String, String>();
|
||||||
|
@ -372,11 +372,11 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
// String custdetailString=doGet(custurl,custMap);
|
// String custdetailString=doGet(custurl,custMap);
|
||||||
//
|
//
|
||||||
// Map custDetailresult = gson.fromJson(custdetailString, Map.class);
|
// Map custDetailresult = gson.fromJson(custdetailString, Map.class);
|
||||||
// if (StringUtils.equals("200", custDetailresult.get("code").toString())) {//客户存在
|
// if (StringUtils.equals("200", custDetailresult.get("code").toString())) {//客户存在
|
||||||
//
|
//
|
||||||
// Map<String, Object> dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
// Map<String, Object> dataInfo = (Map<String, Object>) custDetailresult.get("data");
|
||||||
//
|
//
|
||||||
// if (!MMValueCheck.isEmpty(dataInfo.get("merchantAgentFinancialInfos"))){//客户中已经存在银行账户
|
// if (!MMValueCheck.isEmpty(dataInfo.get("merchantAgentFinancialInfos"))){//客户中已经存在银行账户
|
||||||
//
|
//
|
||||||
// }else {
|
// }else {
|
||||||
//
|
//
|
||||||
|
@ -385,7 +385,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// //开户行
|
// //开户行
|
||||||
// String bankdoccode=map.get("bankdoccode");
|
// String bankdoccode=map.get("bankdoccode");
|
||||||
// HashMap<String, Object> paramap = new HashMap<String, Object>();
|
// HashMap<String, Object> paramap = new HashMap<String, Object>();
|
||||||
// paramap.put("pageIndex", 0);
|
// paramap.put("pageIndex", 0);
|
||||||
|
@ -419,7 +419,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
params.put("appKey", appKey);
|
params.put("appKey", appKey);
|
||||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||||
params.put("timestamp", timestamp);
|
params.put("timestamp", timestamp);
|
||||||
// 计算签名
|
// 计算签名
|
||||||
Map<String, String> treeMap;
|
Map<String, String> treeMap;
|
||||||
if (params instanceof TreeMap) {
|
if (params instanceof TreeMap) {
|
||||||
treeMap = params;
|
treeMap = params;
|
||||||
|
@ -458,9 +458,9 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
cm.setMaxTotal(500);
|
cm.setMaxTotal(500);
|
||||||
cm.setDefaultMaxPerRoute(50);
|
cm.setDefaultMaxPerRoute(50);
|
||||||
|
|
||||||
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
||||||
.setConnectTimeout(5000) // 连接建立超时
|
.setConnectTimeout(5000) // 连接建立超时
|
||||||
.setSocketTimeout(20000) // 等待响应超时
|
.setSocketTimeout(20000) // 等待响应超时
|
||||||
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
||||||
|
|
||||||
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
||||||
|
@ -479,9 +479,9 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
cm.setMaxTotal(500);
|
cm.setMaxTotal(500);
|
||||||
cm.setDefaultMaxPerRoute(50);
|
cm.setDefaultMaxPerRoute(50);
|
||||||
|
|
||||||
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
||||||
.setConnectTimeout(5000) // 连接建立超时
|
.setConnectTimeout(5000) // 连接建立超时
|
||||||
.setSocketTimeout(20000) // 等待响应超时
|
.setSocketTimeout(20000) // 等待响应超时
|
||||||
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
||||||
|
|
||||||
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
||||||
|
@ -516,21 +516,21 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
path += '?' + paramStr;
|
path += '?' + paramStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 创建远程url连接对象
|
// 创建远程url连接对象
|
||||||
URL url = new URL(path);
|
URL url = new URL(path);
|
||||||
if ("https".equalsIgnoreCase(url.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
if ("https".equalsIgnoreCase(url.getProtocol())) {// 判定网址是否信任,不信任则调用忽略信任工具类SslUtil
|
||||||
IgnoreSslUtil.ignoreSsl();
|
IgnoreSslUtil.ignoreSsl();
|
||||||
}
|
}
|
||||||
// 通过远程url连接对象打开一个连接,强转成HTTPURLConnection类
|
// 通过远程url连接对象打开一个连接,强转成HTTPURLConnection类
|
||||||
conn = (HttpURLConnection) url.openConnection();
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
conn.setRequestMethod("GET");
|
conn.setRequestMethod("GET");
|
||||||
// 设置连接超时时间和读取超时时间
|
// 设置连接超时时间和读取超时时间
|
||||||
conn.setConnectTimeout(120000);
|
conn.setConnectTimeout(120000);
|
||||||
conn.setReadTimeout(120000);
|
conn.setReadTimeout(120000);
|
||||||
conn.setRequestProperty("Accept", "application/json");
|
conn.setRequestProperty("Accept", "application/json");
|
||||||
// 发送请求
|
// 发送请求
|
||||||
conn.connect();
|
conn.connect();
|
||||||
// 通过conn取得输入流,并使用Reader读取
|
// 通过conn取得输入流,并使用Reader读取
|
||||||
if (200 == conn.getResponseCode()) {
|
if (200 == conn.getResponseCode()) {
|
||||||
is = conn.getInputStream();
|
is = conn.getInputStream();
|
||||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||||
|
@ -571,9 +571,9 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
||||||
// cm.setMaxTotal(500);
|
// cm.setMaxTotal(500);
|
||||||
// cm.setDefaultMaxPerRoute(50);
|
// cm.setDefaultMaxPerRoute(50);
|
||||||
//
|
//
|
||||||
// RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
// RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
|
||||||
// .setConnectTimeout(5000) // 连接建立超时
|
// .setConnectTimeout(5000) // 连接建立超时
|
||||||
// .setSocketTimeout(20000) // 等待响应超时
|
// .setSocketTimeout(20000) // 等待响应超时
|
||||||
// .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
// .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
||||||
//
|
//
|
||||||
// CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
// CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)
|
||||||
|
|
Loading…
Reference in New Issue