Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
cd74df2de8
|
@ -154,7 +154,7 @@ public class PickmToGeneralInAction implements ICommonAction {
|
||||||
head.setCtrantypeid(pk_billtypeid);
|
head.setCtrantypeid(pk_billtypeid);
|
||||||
head.setVtrantypecode(typeCode);
|
head.setVtrantypecode(typeCode);
|
||||||
head.setCwarehouseid(warehouseId);
|
head.setCwarehouseid(warehouseId);
|
||||||
GeneralInBodyVO[] bodys = inVO.getBodys();
|
/*GeneralInBodyVO[] bodys = inVO.getBodys();
|
||||||
if (bodys != null) {
|
if (bodys != null) {
|
||||||
for (GeneralInBodyVO body : bodys) {
|
for (GeneralInBodyVO body : bodys) {
|
||||||
String cpickmId=body.getCunitid();
|
String cpickmId=body.getCunitid();
|
||||||
|
@ -166,7 +166,7 @@ public class PickmToGeneralInAction implements ICommonAction {
|
||||||
body.setVnotebody((String) cmaterialvidDef261);
|
body.setVnotebody((String) cmaterialvidDef261);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
return inVOS;
|
return inVOS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1621,7 +1621,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||||
* 行数量、金额减少时,销售订单行金额不得小于行累计确认应收金额,销售订单数量不得小于销售订单行累计开票主数量;不允许删除已开票的物料行(判断累计开票主数量是否大于0);
|
* 行数量、金额减少时,销售订单行金额不得小于行累计确认应收金额,销售订单数量不得小于销售订单行累计开票主数量;不允许删除已开票的物料行(判断累计开票主数量是否大于0);
|
||||||
* 3.实际收款和累计开票主数量、累计确认应收金额 >0
|
* 3.实际收款和累计开票主数量、累计确认应收金额 >0
|
||||||
* 变更行金额和行数量时,销售订单行金额不得小于行累计确认应收金额,销售订单行数量不得小于销售订单行累计开票主数量;
|
* 变更行金额和行数量时,销售订单行金额不得小于行累计确认应收金额,销售订单行数量不得小于销售订单行累计开票主数量;
|
||||||
* 4.累计出库主数量 or 累计安排生产订单主数量 or 累计发货主数量 or 累计排产主数量 >0
|
* 4.累计出库主数量 or 累计安排生产订单主数量 or 累计发货主数量 >0
|
||||||
* 不可替换物料,不可删除订单明细行(删除就是把子表VO的dr赋值1,0表示未删除);
|
* 不可替换物料,不可删除订单明细行(删除就是把子表VO的dr赋值1,0表示未删除);
|
||||||
* 行数量减少后的值不可小于 累计出库主数量,累计安排生产订单主数量,累计发货主数量,累计排产主数量
|
* 行数量减少后的值不可小于 累计出库主数量,累计安排生产订单主数量,累计发货主数量,累计排产主数量
|
||||||
* 行金额不得小于行累计确认应收金额与收款金额的最小值
|
* 行金额不得小于行累计确认应收金额与收款金额的最小值
|
||||||
|
@ -1703,11 +1703,10 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.2 累计出库/安排生产/发货/排产
|
// 1.2 累计出库/安排生产/发货
|
||||||
boolean hasOutOrArrange = (ntotaloutnum != null && ntotaloutnum.doubleValue() > 0) ||
|
boolean hasOutOrArrange = (ntotaloutnum != null && ntotaloutnum.doubleValue() > 0) ||
|
||||||
(narrangemonum != null && narrangemonum.doubleValue() > 0) ||
|
(narrangemonum != null && narrangemonum.doubleValue() > 0) ||
|
||||||
(ntotalsendnum != null && ntotalsendnum.doubleValue() > 0) ||
|
(ntotalsendnum != null && ntotalsendnum.doubleValue() > 0);
|
||||||
(vbdef12 != null && vbdef12.doubleValue() > 0);
|
|
||||||
if (hasOutOrArrange) {
|
if (hasOutOrArrange) {
|
||||||
if (newNnum != null && oldNnum != null && newNnum.doubleValue() < oldNnum.doubleValue()) {
|
if (newNnum != null && oldNnum != null && newNnum.doubleValue() < oldNnum.doubleValue()) {
|
||||||
if (ntotaloutnum != null && ntotaloutnum.doubleValue() > 0 && newNnum.doubleValue() < ntotaloutnum.doubleValue()) {
|
if (ntotaloutnum != null && ntotaloutnum.doubleValue() > 0 && newNnum.doubleValue() < ntotaloutnum.doubleValue()) {
|
||||||
|
@ -1719,9 +1718,9 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||||
if (ntotalsendnum != null && ntotalsendnum.doubleValue() > 0 && newNnum.doubleValue() < ntotalsendnum.doubleValue()) {
|
if (ntotalsendnum != null && ntotalsendnum.doubleValue() > 0 && newNnum.doubleValue() < ntotalsendnum.doubleValue()) {
|
||||||
throw new BusinessException("行号:" + crowno + ", 行数量(" + newNnum + ")不可小于累计发货主数量(" + ntotalsendnum + ")");
|
throw new BusinessException("行号:" + crowno + ", 行数量(" + newNnum + ")不可小于累计发货主数量(" + ntotalsendnum + ")");
|
||||||
}
|
}
|
||||||
if (vbdef12 != null && vbdef12.doubleValue() > 0 && newNnum.doubleValue() < vbdef12.doubleValue()) {
|
/*if (vbdef12 != null && vbdef12.doubleValue() > 0 && newNnum.doubleValue() < vbdef12.doubleValue()) {
|
||||||
throw new BusinessException("行号:" + crowno + ", 行数量(" + newNnum + ")不可小于累计排产主数量(" + vbdef12 + ")");
|
throw new BusinessException("行号:" + crowno + ", 行数量(" + newNnum + ")不可小于累计排产主数量(" + vbdef12 + ")");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
// 金额校验
|
// 金额校验
|
||||||
if (ntotalarmny != null && ntotalarmny.doubleValue() > 0) {
|
if (ntotalarmny != null && ntotalarmny.doubleValue() > 0) {
|
||||||
|
@ -1735,7 +1734,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||||
}
|
}
|
||||||
// 1.4 物料替换校验
|
// 1.4 物料替换校验
|
||||||
if (StringUtils.isNotEmpty(oldCmaterialvid) && !newCmaterialvid.equals(oldCmaterialvid)) {
|
if (StringUtils.isNotEmpty(oldCmaterialvid) && !newCmaterialvid.equals(oldCmaterialvid)) {
|
||||||
throw new BusinessException("行号:" + crowno + ",存在累计出库/安排生产订单/发货/排产主数量,请勿修改物料");
|
throw new BusinessException("行号:" + crowno + ",存在累计出库/安排生产订单/发货主数量,请勿修改物料");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 1.3 累计安排生产订单主数量 & 累计排产主数量 >0
|
// 1.3 累计安排生产订单主数量 & 累计排产主数量 >0
|
||||||
|
@ -1757,9 +1756,9 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
|
||||||
}
|
}
|
||||||
if ((ntotaloutnum != null && ntotaloutnum.doubleValue() > 0) ||
|
if ((ntotaloutnum != null && ntotaloutnum.doubleValue() > 0) ||
|
||||||
(narrangemonum != null && narrangemonum.doubleValue() > 0) ||
|
(narrangemonum != null && narrangemonum.doubleValue() > 0) ||
|
||||||
(ntotalsendnum != null && ntotalsendnum.doubleValue() > 0) ||
|
(ntotalsendnum != null && ntotalsendnum.doubleValue() > 0)
|
||||||
(vbdef12 != null && vbdef12.doubleValue() > 0)) {
|
) {
|
||||||
throw new BusinessException("行号:" + crowno + ", 不可删除已有累计出库、安排生产、发货或排产的订单明细行");
|
throw new BusinessException("行号:" + crowno + ", 不可删除已有累计出库、安排生产、发货的订单明细行");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 3. 新增行校验
|
// 3. 新增行校验
|
||||||
|
|
|
@ -104,14 +104,18 @@ public class MaterialPlmDownloadAction implements ICommonAction {
|
||||||
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
|
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
|
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
|
||||||
try {
|
try {
|
||||||
for (String materialCode : materialCodeArr) {
|
for (int i = 0; i < materialCodeArr.length; i++) {
|
||||||
|
String materialCode = materialCodeArr[i];
|
||||||
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
||||||
String objId = plmFileJson.getString("objId");
|
String objId = plmFileJson.getString("objId");
|
||||||
String fname = plmFileJson.getString("fname");
|
// String fname = plmFileJson.getString("fname"); // ¶þάͼµµ.pdf
|
||||||
|
String name = plmFileJson.getString("name");
|
||||||
|
String suffix = plmFileJson.getString("suffix");
|
||||||
byte[] fileBytes = this.doDownloadPlmFile(objId);
|
byte[] fileBytes = this.doDownloadPlmFile(objId);
|
||||||
if (fileBytes.length == 0) {
|
if (fileBytes.length == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
String fname = name + "_" + materialCode + "_" + i + "." + suffix;
|
||||||
zipStream.putNextEntry(new ZipEntry(fname));
|
zipStream.putNextEntry(new ZipEntry(fname));
|
||||||
zipStream.write(fileBytes);
|
zipStream.write(fileBytes);
|
||||||
zipStream.closeEntry();
|
zipStream.closeEntry();
|
||||||
|
|
|
@ -1,283 +0,0 @@
|
||||||
package nc.bs.uapbd.util;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import nc.bs.dao.DAOException;
|
|
||||||
import nc.bs.logging.Log;
|
|
||||||
import nc.bs.trade.business.HYSuperDMO;
|
|
||||||
import nc.vo.bd.defdoc.DefdocVO;
|
|
||||||
import nc.vo.cmp.util.StringUtils;
|
|
||||||
import nc.vo.pub.BusinessException;
|
|
||||||
import nccloud.framework.core.io.WebFile;
|
|
||||||
import org.apache.http.client.config.CookieSpecs;
|
|
||||||
import org.apache.http.client.config.RequestConfig;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import org.apache.http.impl.client.HttpClients;
|
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|
||||||
import org.apache.http.util.EntityUtils;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取PLM图纸的工具类
|
|
||||||
*
|
|
||||||
* @author mzr
|
|
||||||
* @date 2025/8/1
|
|
||||||
*/
|
|
||||||
public class GetPlmFileUtil {
|
|
||||||
private static final String LOG_INFO_NAME = "dldzlog";
|
|
||||||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
|
||||||
private String plmBaseUrl = "";
|
|
||||||
private String plmUser = "";
|
|
||||||
private String token = "";
|
|
||||||
private static final String tokenUrl = "/sipmweb/api/oauth";
|
|
||||||
// 根据物料编码获取零部件ID
|
|
||||||
private String materialIdUrl = "/sipmweb/api/{rid}/search/{t}";
|
|
||||||
// 根据零部件ID获取二维图档ID及信息
|
|
||||||
private String materialFileIdUrl = "/sipmweb/api/{rid}/relation/{t}/{id}/data";
|
|
||||||
// 下载文件
|
|
||||||
private String downlownUrl = "/sipmweb/web/download";
|
|
||||||
// http请求
|
|
||||||
private static final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
|
|
||||||
private static final CloseableHttpClient httpClient;
|
|
||||||
|
|
||||||
static {
|
|
||||||
connectionManager.setMaxTotal(5000);
|
|
||||||
connectionManager.setDefaultMaxPerRoute(500);
|
|
||||||
|
|
||||||
RequestConfig globalConfig = RequestConfig.custom()
|
|
||||||
.setConnectionRequestTimeout(50000)
|
|
||||||
.setConnectTimeout(50000)
|
|
||||||
.setSocketTimeout(200000)
|
|
||||||
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
httpClient = HttpClients.custom()
|
|
||||||
.setConnectionManager(connectionManager)
|
|
||||||
.setDefaultRequestConfig(globalConfig)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public WebFile getPlmFiles(String[] materialCodeArr) throws Exception {
|
|
||||||
WebFile file = null;
|
|
||||||
if (materialCodeArr == null || materialCodeArr.length == 0) {
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
// 获取PLM的参数
|
|
||||||
Map<String, String> configParams = getConfigParams("Dldz-config");
|
|
||||||
if (configParams == null || configParams.isEmpty()) {
|
|
||||||
throw new BusinessException("未配置PLM参数");
|
|
||||||
}
|
|
||||||
plmBaseUrl = configParams.get("plmBaseUrl");
|
|
||||||
plmUser = configParams.get("plmUser");
|
|
||||||
token = getToken();
|
|
||||||
if (materialCodeArr.length == 1) {
|
|
||||||
String materialCode = materialCodeArr[0];
|
|
||||||
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
|
||||||
String objId = plmFileJson.getString("objId");
|
|
||||||
String fname = plmFileJson.getString("fname");
|
|
||||||
|
|
||||||
byte[] fileBytes = this.doDownloadPlmFile(objId);
|
|
||||||
if (fileBytes.length == 0) {
|
|
||||||
throw new BusinessException("未查询到PLM的文件");
|
|
||||||
}
|
|
||||||
InputStream ins = new ByteArrayInputStream(fileBytes);
|
|
||||||
file = new WebFile(fname, ins);
|
|
||||||
} else {
|
|
||||||
// 多个物料合并成zip文件输出文件流
|
|
||||||
// 创建内存中的 ZIP 输出流
|
|
||||||
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
|
|
||||||
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
|
|
||||||
try {
|
|
||||||
for (String materialCode : materialCodeArr) {
|
|
||||||
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
|
||||||
String objId = plmFileJson.getString("objId");
|
|
||||||
String fname = plmFileJson.getString("fname");
|
|
||||||
byte[] fileBytes = this.doDownloadPlmFile(objId);
|
|
||||||
if (fileBytes.length == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
zipStream.putNextEntry(new ZipEntry(fname));
|
|
||||||
zipStream.write(fileBytes);
|
|
||||||
zipStream.closeEntry();
|
|
||||||
}
|
|
||||||
zipStream.finish();
|
|
||||||
} finally {
|
|
||||||
zipStream.close();
|
|
||||||
}
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
|
||||||
String zipName = "物料图纸下载_" + sdf.format(new Date());
|
|
||||||
// 构造 WebFile 返回 ZIP 文件
|
|
||||||
InputStream ins = new ByteArrayInputStream(zipOut.toByteArray());
|
|
||||||
file = new WebFile(zipName + ".zip", ins);
|
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONObject getPlmFile(String materialCode) throws Exception {
|
|
||||||
String materialId = getMaterialId(materialCode);
|
|
||||||
return getFileId(materialId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取token
|
|
||||||
*/
|
|
||||||
private String getToken() throws IOException, BusinessException {
|
|
||||||
Map<String, String> tokenMap = new HashMap<>();
|
|
||||||
tokenMap.put("uname", plmUser);
|
|
||||||
tokenMap.put("f", "true");
|
|
||||||
String tokenStr = doGet(plmBaseUrl + tokenUrl, tokenMap);
|
|
||||||
logger.error("GetPlmFileUtil-getToken-tokenStr = " + tokenStr);
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(tokenStr);
|
|
||||||
String token = jsonObject.getString("errmsg");
|
|
||||||
if (token == null || token.isEmpty()) {
|
|
||||||
throw new BusinessException("PLM鉴权失败");
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据物料编码获取零部件ID
|
|
||||||
*/
|
|
||||||
private String getMaterialId(String materialCode) throws IOException, BusinessException {
|
|
||||||
String fileUrl = plmBaseUrl + materialIdUrl;
|
|
||||||
fileUrl = fileUrl.replace("{rid}", token);
|
|
||||||
// 对象表名 MPART(零部件)
|
|
||||||
fileUrl = fileUrl.replace("{t}", "MPART");
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
map.put("key", materialCode);// 搜索关键字
|
|
||||||
map.put("start", "0");// 偏移量
|
|
||||||
map.put("size", "10");// 数量
|
|
||||||
String result = doGet(fileUrl, map);
|
|
||||||
logger.error("GetPlmFileUtil-getMaterialId-result = " + result);
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
||||||
String list = jsonObject.getString("list");
|
|
||||||
JSONArray jsonArray = JSONObject.parseArray(list);
|
|
||||||
if (jsonArray == null || jsonArray.isEmpty()) {
|
|
||||||
throw new BusinessException("获取PLM物料id失败");
|
|
||||||
}
|
|
||||||
JSONObject listJson = jsonArray.getJSONObject(0);
|
|
||||||
String objId = listJson.getString("objId");
|
|
||||||
if (objId == null || objId.isEmpty()) {
|
|
||||||
throw new BusinessException("获取PLM物料id失败");
|
|
||||||
}
|
|
||||||
return objId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据零部件ID获取文件ID
|
|
||||||
*/
|
|
||||||
private JSONObject getFileId(String materialId) throws IOException, BusinessException {
|
|
||||||
String fileUrl = plmBaseUrl + materialFileIdUrl;
|
|
||||||
fileUrl = fileUrl.replace("{rid}", token);
|
|
||||||
// 对象表名 MPART(零部件)
|
|
||||||
fileUrl = fileUrl.replace("{t}", "MPART");
|
|
||||||
// 对象id
|
|
||||||
fileUrl = fileUrl.replace("{id}", materialId);
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
map.put("re", "MPART_SIPM1");// 关系ID 二维图档:MPART_SIPM1
|
|
||||||
map.put("start", "0");// 偏移量
|
|
||||||
map.put("item", "SIPM1");// 关联对象表名
|
|
||||||
String result = doGet(fileUrl, map);
|
|
||||||
logger.error("GetPlmFileUtil-getFileId-result = " + result);
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
||||||
String list = jsonObject.getString("list");
|
|
||||||
JSONArray jsonArray = JSONObject.parseArray(list);
|
|
||||||
if (jsonArray == null || jsonArray.isEmpty()) {
|
|
||||||
throw new BusinessException("获取PLM物料的文件信息失败");
|
|
||||||
}
|
|
||||||
JSONObject listJson = jsonArray.getJSONObject(0);
|
|
||||||
String objId = listJson.getString("objId");
|
|
||||||
if (objId == null || objId.isEmpty()) {
|
|
||||||
throw new BusinessException("获取PLM物料的文件信息失败");
|
|
||||||
}
|
|
||||||
return listJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用PLM的下载文件接口
|
|
||||||
*/
|
|
||||||
private byte[] doDownloadPlmFile(String fileId) throws IOException {
|
|
||||||
String fileUrl = plmBaseUrl + downlownUrl;
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
map.put("rid", token);
|
|
||||||
map.put("id", fileId);// 对象id
|
|
||||||
map.put("t", "SIPM1");// 对象表名
|
|
||||||
map.put("type", "D");// 文件类别(BD,D)(D是文件本身的文件,BD是PDF图)
|
|
||||||
return getFileFromPlm(fileUrl, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getConfigParams(String code) {
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='[code]' and dr=0 ) and dr=0";
|
|
||||||
strWhere = strWhere.replace("[code]", code);
|
|
||||||
try {
|
|
||||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
|
||||||
if (defdocVOs != null) {
|
|
||||||
for (DefdocVO defdocVO : defdocVOs) {
|
|
||||||
String value = StringUtils.isEmpty(defdocVO.getMemo()) ? defdocVO.getName() : defdocVO.getMemo();
|
|
||||||
map.put(defdocVO.getCode().trim(), value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (DAOException e) {
|
|
||||||
logger.error("Failed to get config parameters for code: " + code, e);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String doGet(String requestUrl, Map<String, String> paramMap) throws IOException {
|
|
||||||
StringBuilder param = new StringBuilder("?");
|
|
||||||
if (paramMap != null) {
|
|
||||||
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
|
|
||||||
param.append(entry.getKey());
|
|
||||||
param.append("=");
|
|
||||||
param.append(entry.getValue());
|
|
||||||
param.append("&");
|
|
||||||
}
|
|
||||||
param.deleteCharAt(param.length() - 1);
|
|
||||||
}
|
|
||||||
String url = requestUrl + param;
|
|
||||||
HttpGet get = new HttpGet(url);
|
|
||||||
String responseString = httpClient.execute(get, response -> EntityUtils.toString(response.getEntity()));
|
|
||||||
get.releaseConnection();
|
|
||||||
return responseString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用第三方文件接口并接收文件流
|
|
||||||
*
|
|
||||||
* @param requestUrl 文件接口URL
|
|
||||||
* @return 文件流
|
|
||||||
*/
|
|
||||||
private byte[] getFileFromPlm(String requestUrl, Map<String, String> paramMap) throws IOException {
|
|
||||||
StringBuilder param = new StringBuilder("?");
|
|
||||||
if (paramMap != null) {
|
|
||||||
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
|
|
||||||
param.append(entry.getKey());
|
|
||||||
param.append("=");
|
|
||||||
param.append(entry.getValue());
|
|
||||||
param.append("&");
|
|
||||||
}
|
|
||||||
param.deleteCharAt(param.length() - 1);
|
|
||||||
}
|
|
||||||
String url = requestUrl + param;
|
|
||||||
HttpGet get = new HttpGet(url);
|
|
||||||
byte[] responseString = httpClient.execute(get, response -> EntityUtils.toByteArray(response.getEntity()));
|
|
||||||
get.releaseConnection();
|
|
||||||
return responseString;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue