Merge remote-tracking branch 'origin/fix_foton_20230613' into fix_foton_20230613
This commit is contained in:
+8
-1
@@ -1041,7 +1041,7 @@ public class WorkFlowController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation(value = "查找在线编辑文件")
|
@ApiOperation(value = "查找在线编辑文件")
|
||||||
@GetMapping("/selectOnlineFile")
|
@GetMapping("/selectOnlineFile")
|
||||||
public ResponseMessage selectOnlineFile(@RequestParam("onlineFileId") String onlineFileId,@RequestParam("standName") String standName) {
|
public ResponseMessage selectOnlineFile(@RequestParam("onlineFileId") String onlineFileId,@RequestParam("standName") String standName,@RequestParam("key") String key) {
|
||||||
logger.info("======================standName===============================!!!!!!!!!!!!!!!!!!!!!!"+standName);
|
logger.info("======================standName===============================!!!!!!!!!!!!!!!!!!!!!!"+standName);
|
||||||
String path = standEditFilePath+"/hisFile/";
|
String path = standEditFilePath+"/hisFile/";
|
||||||
File file = null;
|
File file = null;
|
||||||
@@ -1091,6 +1091,7 @@ public class WorkFlowController extends BaseController {
|
|||||||
onlineFileLog.setCreateTime(new Date());
|
onlineFileLog.setCreateTime(new Date());
|
||||||
onlineFileLog.setFileName(String.valueOf(time));
|
onlineFileLog.setFileName(String.valueOf(time));
|
||||||
onlineFileLog.setValidFlag("0");
|
onlineFileLog.setValidFlag("0");
|
||||||
|
onlineFileLog.setFilekey(key);
|
||||||
onlineFileLogDao.insert(onlineFileLog);
|
onlineFileLogDao.insert(onlineFileLog);
|
||||||
logger.info("======================日志存入成功==============================="+onlineFileLog.toString());
|
logger.info("======================日志存入成功==============================="+onlineFileLog.toString());
|
||||||
if(StringUtils.isNotBlank(standName)) {
|
if(StringUtils.isNotBlank(standName)) {
|
||||||
@@ -1516,4 +1517,10 @@ public class WorkFlowController extends BaseController {
|
|||||||
public String fushen(){
|
public String fushen(){
|
||||||
return workFlowFeignClient.fushen();
|
return workFlowFeignClient.fushen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "|在线文件调用api")
|
||||||
|
@PostMapping("/conversionOnlineFilePDF")
|
||||||
|
public void conversionOnlineFilePDF(){
|
||||||
|
// return workFlowFeignClient.conversionOnlineFilePDF();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-22
@@ -402,20 +402,6 @@ public class ActSarItemsBussEOService {
|
|||||||
standCode = sarBussionessStand.getStandCode();
|
standCode = sarBussionessStand.getStandCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryWrapper<SarBussionessStand>queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq(sarBussionessStand.getStandCode() != null,"STAND_CODE",sarBussionessStand.getStandCode())
|
|
||||||
.eq(sarBussionessStand.getStandName() != null,"STAND_NAME",sarBussionessStand.getStandName());
|
|
||||||
List<SarBussionessStand> list = iSarBussionessStandService.list(queryWrapper);
|
|
||||||
Integer valIdFlag = 0;
|
|
||||||
for (SarBussionessStand stand :list){
|
|
||||||
if ((list.size() ==1 && !list.get(0).getId().equals(stand.getId())) || list.size() >1){
|
|
||||||
valIdFlag = stand.getValidFlag();
|
|
||||||
if (valIdFlag == 0){
|
|
||||||
logger.info("企标标准号"+ sarBussionessStand.getStandCode() +"或企标名称"+ sarBussionessStand.getStandName() +"已存在");
|
|
||||||
throw new AdcDaBaseException("企标标准号"+ sarBussionessStand.getStandCode() +"或企标名称"+ sarBussionessStand.getStandName() +"已存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(standNum)){
|
if (StringUtils.isNotBlank(standNum)){
|
||||||
sarBussionessStand.setStandNumber(standNum);
|
sarBussionessStand.setStandNumber(standNum);
|
||||||
@@ -496,14 +482,6 @@ public class ActSarItemsBussEOService {
|
|||||||
// 新增方法
|
// 新增方法
|
||||||
sarBussionessStand.setPrcCreateUser(prcCreateUser);
|
sarBussionessStand.setPrcCreateUser(prcCreateUser);
|
||||||
sarBussionessStand.setReplaceStandNum(DTQBBHBUSS);
|
sarBussionessStand.setReplaceStandNum(DTQBBHBUSS);
|
||||||
// 根据标准号判断数据是否已存在
|
|
||||||
// QueryWrapper<SarBussionessStand>queryWrapper = new QueryWrapper<>();
|
|
||||||
// queryWrapper.eq(sarBussionessStand.getStandCode() != null,"STAND_CODE",sarBussionessStand.getStandCode())
|
|
||||||
// .eq(sarBussionessStand.getStandName() != null,"STAND_NAME",sarBussionessStand.getStandName());
|
|
||||||
// Integer count = iSarBussionessStandService.count(queryWrapper);
|
|
||||||
// if (count > 0){
|
|
||||||
// throw new AdcDaBaseException("当前企标标准号和企标名称已存在");
|
|
||||||
// }
|
|
||||||
//制定和修订类型 清除历史版本
|
//制定和修订类型 清除历史版本
|
||||||
JSONObject atteObj = JSON.parseObject(sarBussionessStand.getSarStandAttrEOStr());
|
JSONObject atteObj = JSON.parseObject(sarBussionessStand.getSarStandAttrEOStr());
|
||||||
atteObj.remove("LSBBBUSS");
|
atteObj.remove("LSBBBUSS");
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ public class OnlineFileLog extends BaseEntity {
|
|||||||
@TableField("VALID_FLAG")
|
@TableField("VALID_FLAG")
|
||||||
private String validFlag;
|
private String validFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文件key")
|
||||||
|
@TableField("FILE_KEY")
|
||||||
|
private String filekey;
|
||||||
//跨服io流转换
|
//跨服io流转换
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private byte[] bytes;
|
private byte[] bytes;
|
||||||
|
|||||||
+7
@@ -74,4 +74,11 @@ public class SarBussStandFileController extends BaseController<SarBussStandFile>
|
|||||||
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile() throws Exception {
|
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile() throws Exception {
|
||||||
return sarBussStandFileEOService.batchUpdateSarBussFile();
|
return sarBussStandFileEOService.batchUpdateSarBussFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "|SarBussStandFileEO|批量修改加密文件不能打开问题")
|
||||||
|
@GetMapping("/batchUpdateSarBussFileMQ")
|
||||||
|
/*@RequiresPermissions("lawss:sarLawsFile:list")*/
|
||||||
|
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFileMQ() throws Exception {
|
||||||
|
return sarBussStandFileEOService.batchUpdateSarBussFileMQ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -19,4 +19,6 @@ public interface ISarBussStandFileService extends IService<SarBussStandFile> {
|
|||||||
List<SarBussStandFile> selectFileByAttId(String attId) throws Exception;
|
List<SarBussStandFile> selectFileByAttId(String attId) throws Exception;
|
||||||
|
|
||||||
ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile();
|
ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile();
|
||||||
|
|
||||||
|
ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFileMQ();
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-3
@@ -1,25 +1,26 @@
|
|||||||
package com.adc.da.slrs.sarBussStandFile.service.impl;
|
package com.adc.da.slrs.sarBussStandFile.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.att.entity.AttFileEO;
|
||||||
import com.adc.da.att.service.IAttFileEOService;
|
import com.adc.da.att.service.IAttFileEOService;
|
||||||
import com.adc.da.att.vo.AttFileVo;
|
import com.adc.da.att.vo.AttFileVo;
|
||||||
import com.adc.da.common.UseModuleEnum;
|
import com.adc.da.common.UseModuleEnum;
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
|
import com.adc.da.mq.CreateOnlineEditingFileMQService;
|
||||||
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
||||||
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
||||||
import com.adc.da.slrs.sarBussStandFile.service.ISarBussStandFileService;
|
import com.adc.da.slrs.sarBussStandFile.service.ISarBussStandFileService;
|
||||||
import com.adc.da.slrs.sarBussionessStand.service.impl.SarBussionessStandServiceImpl;
|
import com.adc.da.slrs.sarBussionessStand.service.impl.SarBussionessStandServiceImpl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -43,6 +44,9 @@ public class SarBussStandFileServiceImpl extends ServiceImpl<SarBussStandFileDao
|
|||||||
@Value("${file.path}")
|
@Value("${file.path}")
|
||||||
private String filePath;//文件存储路径
|
private String filePath;//文件存储路径
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CreateOnlineEditingFileMQService createOnlineEditingFileMQService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SarBussStandFile> selectFileByAttId(String attId) throws Exception{
|
public List<SarBussStandFile> selectFileByAttId(String attId) throws Exception{
|
||||||
return sarStandFileEODao.selectFileByAttId(attId);
|
return sarStandFileEODao.selectFileByAttId(attId);
|
||||||
@@ -93,4 +97,47 @@ public class SarBussStandFileServiceImpl extends ServiceImpl<SarBussStandFileDao
|
|||||||
logger.info("======================================转换完成================================="+objects.toString());
|
logger.info("======================================转换完成================================="+objects.toString());
|
||||||
return Result.success(objects);
|
return Result.success(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFileMQ() {
|
||||||
|
List<SarBussStandFile> sarBussStandFileArrayList = new ArrayList<>();
|
||||||
|
QueryWrapper<SarBussStandFile> objectQueryWrapper = new QueryWrapper<>();
|
||||||
|
objectQueryWrapper.eq("USE_MODEL","SOURCE_FILE");
|
||||||
|
objectQueryWrapper.ne("FILE_SUFFIX","pdf");
|
||||||
|
objectQueryWrapper.ne("FILE_SUFFIX","PDF");
|
||||||
|
List<SarBussStandFile> sarBussStandFiles = sarStandFileEODao.selectList(objectQueryWrapper);
|
||||||
|
if(!sarBussStandFiles.isEmpty()){
|
||||||
|
for (SarBussStandFile data :sarBussStandFiles) {
|
||||||
|
QueryWrapper<SarBussStandFile> QueryWrapper = new QueryWrapper<>();
|
||||||
|
QueryWrapper.eq("ORI_ATT_ID",data.getOriAttId());
|
||||||
|
QueryWrapper.eq("USE_MODEL", "WEB_FILE");
|
||||||
|
List<SarBussStandFile> sarBussStandFileList = sarStandFileEODao.selectList(QueryWrapper);
|
||||||
|
if(sarBussStandFileList.isEmpty() && sarBussStandFileList.size()==0){
|
||||||
|
AttFileEO fileInfo = attFileEOService.getFileInfo(sarBussStandFiles.get(0).getOriAttId());
|
||||||
|
if(fileInfo!=null){
|
||||||
|
String fileName = "";
|
||||||
|
if(StringUtils.isNotBlank(fileInfo.getFileName())){
|
||||||
|
String[] splitInfo = fileInfo.getFileName().split("\\.");
|
||||||
|
fileName = splitInfo[0];
|
||||||
|
}
|
||||||
|
Map<String, String> bussMap = new HashMap<>();
|
||||||
|
bussMap.put("FILE_SUFFIX",sarBussStandFiles.get(0).getFileSuffix());
|
||||||
|
bussMap.put("CONVERFILENAME",filePath+fileInfo.getFilePath()+fileInfo.getFileName());
|
||||||
|
bussMap.put("SAVEPDFPATH",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
||||||
|
bussMap.put("STANDID",sarBussStandFiles.get(0).getStandId());
|
||||||
|
bussMap.put("STANDFILECLASSIFY",sarBussStandFiles.get(0).getStandFileClassify());
|
||||||
|
bussMap.put("FILENAME",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
||||||
|
bussMap.put("PASSWORD",sarBussStandFiles.get(0).getPassword());
|
||||||
|
bussMap.put("OAIATTID",sarBussStandFiles.get(0).getOriAttId());
|
||||||
|
logger.info("======================================word.doc发送mq=================================");
|
||||||
|
createOnlineEditingFileMQService.OnlineEditingFileMQ(bussMap);
|
||||||
|
sarBussStandFileArrayList.add(data);
|
||||||
|
}else {
|
||||||
|
logger.info("======================================word.doc转换失败=================================");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success(sarBussStandFileArrayList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+77
@@ -55,6 +55,7 @@ import io.swagger.annotations.Api;
|
|||||||
import com.adc.da.base.web.BaseController;
|
import com.adc.da.base.web.BaseController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import springfox.documentation.spring.web.json.Json;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -158,6 +159,61 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
|||||||
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx",request));
|
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx",request));
|
||||||
response.setContentType("application/force-download");
|
response.setContentType("application/force-download");
|
||||||
//导出数据
|
//导出数据
|
||||||
|
if(StringUtils.isNotBlank(exportContent)){
|
||||||
|
if(exportContent.contains("pageSize") ){
|
||||||
|
SarBussionessStandEOPage page = new SarBussionessStandEOPage();
|
||||||
|
page.setPage(1);
|
||||||
|
int count = sarBussionessStandEOService.count();
|
||||||
|
page.setPageSize(count);
|
||||||
|
page.setValidFlag("0");
|
||||||
|
page.setUserId(userId);
|
||||||
|
page.setIsKU("1");
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(exportContent);
|
||||||
|
if(jsonObject!=null){
|
||||||
|
Object standName = jsonObject.get("standName");
|
||||||
|
Object standCode = jsonObject.get("standCode");
|
||||||
|
Object menuId = jsonObject.get("menuId");
|
||||||
|
Object treeType = jsonObject.get("treeType");
|
||||||
|
if(standName!=null){
|
||||||
|
String standNameInfo = standName.toString();
|
||||||
|
if(StringUtils.isNotBlank(standNameInfo)){
|
||||||
|
page.setStandName(standNameInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(standCode!=null){
|
||||||
|
String standCodeInfo = standCode.toString();
|
||||||
|
if(StringUtils.isNotBlank(standCodeInfo)){
|
||||||
|
page.setStandCode(standCodeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(menuId!=null){
|
||||||
|
String menuIdInfo = menuId.toString();
|
||||||
|
if(StringUtils.isNotBlank(menuIdInfo)){
|
||||||
|
page.setMenuId(menuIdInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(treeType!=null){
|
||||||
|
String treeTypeInfo = treeType.toString();
|
||||||
|
if(StringUtils.isNotBlank(treeTypeInfo)){
|
||||||
|
page.setTreeType(treeTypeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
|
||||||
|
exportContent = "";
|
||||||
|
if(!rows.isEmpty()){
|
||||||
|
for (SarBussionessStand data: rows){
|
||||||
|
if(StringUtils.isNotBlank(exportContent)){
|
||||||
|
exportContent = exportContent+","+data.getId();
|
||||||
|
}else {
|
||||||
|
exportContent = data.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
exportType = "apart";
|
||||||
|
}
|
||||||
List<SarBussionessStandExport> datas = sarBussionessStandEOService.getSarBussionessStand(exportType,exportContent,userId);
|
List<SarBussionessStandExport> datas = sarBussionessStandEOService.getSarBussionessStand(exportType,exportContent,userId);
|
||||||
workbook = BussStandExportUtil.exportDatas(datas);
|
workbook = BussStandExportUtil.exportDatas(datas);
|
||||||
os = response.getOutputStream();
|
os = response.getOutputStream();
|
||||||
@@ -678,5 +734,26 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
|||||||
public ResponseMessage repeal(String id,String type){
|
public ResponseMessage repeal(String id,String type){
|
||||||
return sarBussionessStandEOService.repeal(id,type);
|
return sarBussionessStandEOService.repeal(id,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "企标发布节点完成任务和入库接口执行前先执行校验编号和名称校验")
|
||||||
|
@PostMapping("/ifStandCodebyStandName")
|
||||||
|
public ResponseMessage ifStandCodebyStandName(String standCode,String standName){
|
||||||
|
QueryWrapper<SarBussionessStand>queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(standCode != null,"STAND_CODE",standCode)
|
||||||
|
.eq(standName != null,"STAND_NAME",standName);
|
||||||
|
List<SarBussionessStand> list = sarBussionessStandEOService.list(queryWrapper);
|
||||||
|
Integer valIdFlag = 0;
|
||||||
|
for (SarBussionessStand stand :list){
|
||||||
|
if ((list.size() ==1 && !list.get(0).getId().equals(stand.getId())) || list.size() >1){
|
||||||
|
valIdFlag = stand.getValidFlag();
|
||||||
|
if (valIdFlag == 0){
|
||||||
|
logger.info("企标标准号"+ standCode +"和企标名称"+ standName +"已存在");
|
||||||
|
return Result.error("企标标准号"+ standCode +"和企标名称"+ standName +"已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success("校验通过");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+29
-30
@@ -398,6 +398,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
|||||||
if ("apart".equals(exportType)) {
|
if ("apart".equals(exportType)) {
|
||||||
page.setIdlist(exportContent.split(","));
|
page.setIdlist(exportContent.split(","));
|
||||||
} else {
|
} else {
|
||||||
|
if(StringUtils.isNotBlank(exportContent)) {
|
||||||
JSONObject jsonObject = JSONObject.fromObject(exportContent);
|
JSONObject jsonObject = JSONObject.fromObject(exportContent);
|
||||||
page = (SarBussionessStandEOPage) JSONObject.toBean(jsonObject, SarBussionessStandEOPage.class);
|
page = (SarBussionessStandEOPage) JSONObject.toBean(jsonObject, SarBussionessStandEOPage.class);
|
||||||
page.setPage(1);
|
page.setPage(1);
|
||||||
@@ -457,6 +458,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
page.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
|
page.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
|
||||||
if(userId != null){
|
if(userId != null){
|
||||||
page.setUserId(userId);
|
page.setUserId(userId);
|
||||||
@@ -1361,13 +1363,13 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
|||||||
sarBussionessStandEO = newStandList.get(0);
|
sarBussionessStandEO = newStandList.get(0);
|
||||||
}
|
}
|
||||||
// 处理 在线编辑pdf存储失败问题 发布稿的在线编辑文件 判断文件表是否有没有则 添加 每次进入 都进行判断
|
// 处理 在线编辑pdf存储失败问题 发布稿的在线编辑文件 判断文件表是否有没有则 添加 每次进入 都进行判断
|
||||||
// Object fbgbuss = sarBussionessStandEO.getAttrInfoCaseMap().get("fbgbuss");
|
Object fbgbuss = sarBussionessStandEO.getAttrInfoCaseMap().get("fbgbuss");
|
||||||
// if(fbgbuss!=null) {
|
if(fbgbuss!=null) {
|
||||||
// String fbgbussStr = fbgbuss.toString();
|
String fbgbussStr = fbgbuss.toString();
|
||||||
// if(StringUtils.isNotBlank(fbgbussStr)){
|
if(StringUtils.isNotBlank(fbgbussStr)){
|
||||||
// sarStandFilePdf(fbgbussStr);
|
sarStandFilePdf(fbgbussStr);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return sarBussionessStandEO;
|
return sarBussionessStandEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4920,7 +4922,17 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
|||||||
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
|
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
|
||||||
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
|
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
|
||||||
if(sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==0){
|
if(sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==0){
|
||||||
AttFileVo attFileVo = attFileEOService.wordConversionFilePdf(sarBussStandFiles.get(0).getOriAttId());
|
//存储的名称,key 路径
|
||||||
|
QueryWrapper<OnlineFileLog> onlineFileLogWrapper = new QueryWrapper<>();
|
||||||
|
onlineFileLogWrapper.eq("ATT_FILE_ID",sarBussStandFilesList.get(0).getOriAttId());
|
||||||
|
List<OnlineFileLog> onlineFileLogs = onlineFileLogDao.selectList(onlineFileLogWrapper);
|
||||||
|
if(!onlineFileLogs.isEmpty()){
|
||||||
|
if(StringUtils.isNotBlank(onlineFileLogs.get(0).getOLdFileName()) && StringUtils.isNotBlank(onlineFileLogs.get(0).getFilekey()) && StringUtils.isNotBlank(onlineFileLogs.get(0).getFilePath())){
|
||||||
|
try {
|
||||||
|
OnlyofficePdfUtil.downloadFile(filePath,onlineFileLogs.get(0).getOLdFileName(), onlineFileLogs.get(0).getFilekey(), onlineFileLogs.get(0).getFilePath());
|
||||||
|
File file = new File(filePath+"/onlineFile/"+onlineFileLogs.get(0).getOLdFileName());
|
||||||
|
if(file.exists()){
|
||||||
|
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||||
if(attFileVo!=null){
|
if(attFileVo!=null){
|
||||||
SarBussStandFile sarBussStandFile = new SarBussStandFile();
|
SarBussStandFile sarBussStandFile = new SarBussStandFile();
|
||||||
//sarBussStandFile.setId();
|
//sarBussStandFile.setId();
|
||||||
@@ -4941,28 +4953,15 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
|||||||
}else {
|
}else {
|
||||||
logger.info("======================================word.doc转换失败=================================");
|
logger.info("======================================word.doc转换失败=================================");
|
||||||
}
|
}
|
||||||
// AttFileEO fileInfo = attFileEOService.getFileInfo(sarBussStandFiles.get(0).getOriAttId());
|
}
|
||||||
// if(fileInfo!=null){
|
} catch (Exception e) {
|
||||||
// String fileName = "";
|
e.printStackTrace();
|
||||||
// if(StringUtils.isNotBlank(fileInfo.getFileName())){
|
}
|
||||||
// String[] splitInfo = fileInfo.getFileName().split("\\.");
|
}
|
||||||
// fileName = splitInfo[0];
|
|
||||||
// }
|
}else {
|
||||||
//
|
logger.info("======================未能查询到在线编辑的日志文件================");
|
||||||
// Map<String, String> bussMap = new HashMap<>();
|
}
|
||||||
// bussMap.put("FILE_SUFFIX",sarBussStandFiles.get(0).getFileSuffix());
|
|
||||||
// bussMap.put("CONVERFILENAME",filePath+fileInfo.getFilePath()+fileInfo.getFileName());
|
|
||||||
// bussMap.put("SAVEPDFPATH",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
|
||||||
// bussMap.put("STANDID",sarBussStandFiles.get(0).getStandId());
|
|
||||||
// bussMap.put("STANDFILECLASSIFY",sarBussStandFiles.get(0).getStandFileClassify());
|
|
||||||
// bussMap.put("FILENAME",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
|
||||||
// bussMap.put("PASSWORD",sarBussStandFiles.get(0).getPassword());
|
|
||||||
// bussMap.put("OAIATTID",sarBussStandFiles.get(0).getOriAttId());
|
|
||||||
// logger.info("======================================word.doc发送mq=================================");
|
|
||||||
// createOnlineEditingFileMQService.OnlineEditingFileMQ(bussMap);
|
|
||||||
// }else {
|
|
||||||
// logger.info("======================================word.doc转换失败=================================");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+101
-1
@@ -4,6 +4,8 @@ package com.adc.da.slrs.sarStandardsInfo.controller;
|
|||||||
import cn.hutool.core.util.ZipUtil;
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import com.adc.da.Log.BusinessType;
|
import com.adc.da.Log.BusinessType;
|
||||||
import com.adc.da.Log.EpcLog;
|
import com.adc.da.Log.EpcLog;
|
||||||
|
import com.adc.da.att.service.IAttFileEOService;
|
||||||
|
import com.adc.da.att.vo.AttFileVo;
|
||||||
import com.adc.da.common.FileUnZip;
|
import com.adc.da.common.FileUnZip;
|
||||||
import com.adc.da.common.ReadExcel;
|
import com.adc.da.common.ReadExcel;
|
||||||
import com.adc.da.exception.AdcDaBaseException;
|
import com.adc.da.exception.AdcDaBaseException;
|
||||||
@@ -29,6 +31,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
@@ -75,7 +84,6 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISarStandFileService sarStandFileService;
|
private ISarStandFileService sarStandFileService;
|
||||||
|
|
||||||
|
|
||||||
@Value("${file.path}")
|
@Value("${file.path}")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
@@ -89,6 +97,9 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
|||||||
@Autowired
|
@Autowired
|
||||||
ISarLawsInfoService sarLawsInfoEOService;
|
ISarLawsInfoService sarLawsInfoEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IAttFileEOService iAttFileEOService;
|
||||||
|
|
||||||
// @ApiOperation(value="SarStandardsInfoEO|反向标准操作")
|
// @ApiOperation(value="SarStandardsInfoEO|反向标准操作")
|
||||||
// @GetMapping(value = "/reverseQueryStand")
|
// @GetMapping(value = "/reverseQueryStand")
|
||||||
// public void reverseQueryStand(@RequestParam(name="ids",required=true) String ids, String standName, String type) {
|
// public void reverseQueryStand(@RequestParam(name="ids",required=true) String ids, String standName, String type) {
|
||||||
@@ -1047,4 +1058,93 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
|||||||
public ResponseMessage fileNameTranslation (){
|
public ResponseMessage fileNameTranslation (){
|
||||||
return sarStandardsInfoEOService.fileNameTranslation();
|
return sarStandardsInfoEOService.fileNameTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "|SarStandardsInfoEO|编号+名称组合为唯一标识(国内海外)")
|
||||||
|
@PostMapping("/ceshi")
|
||||||
|
public ResponseMessage ceshi (String docx,String urlInfo){
|
||||||
|
String e7FAFC9C22A8 = onlyofficePdfUtil("E7FAFC9C22A8", "1111111.pdf", docx,urlInfo);
|
||||||
|
return Result.success(e7FAFC9C22A8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String onlyofficePdfUtil(String key,String title,String urlFile,String urlInfo){
|
||||||
|
HttpClient client = HttpClients.createDefault();
|
||||||
|
Map<String, Object> cmd = new HashMap<>();
|
||||||
|
cmd.put("async",false);
|
||||||
|
cmd.put("filetype","docx");
|
||||||
|
cmd.put("key",key);
|
||||||
|
cmd.put("title",title);
|
||||||
|
cmd.put("url",urlFile);
|
||||||
|
//http://47.92.92.38:8103/7.2.1-34/ConvertService.ashx
|
||||||
|
//https://example.com/url-to-example-document.docx
|
||||||
|
//String url = "http://47.92.92.38:8103/url-to-example-document.docx";
|
||||||
|
// String url = "http://47.92.92.38:8103/7.2.1-34/downloadas";
|
||||||
|
String url = "";
|
||||||
|
//"url": "https://127.0.0.1/document/example.docx"
|
||||||
|
|
||||||
|
if(urlInfo.equals("1")){
|
||||||
|
url = "http://47.92.92.38:8103/7.2.1-34/ConvertService.ashx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("2")){
|
||||||
|
url = "http://39.98.140.126:8889/7.2.1-34/ConvertService.ashx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("3")){
|
||||||
|
url = "http://10.100.5.116:8088//7.2.1-34/ConvertService.ashx";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(urlInfo.equals("11")){
|
||||||
|
url = "http://47.92.92.38:8103/7.2.1-34/document/example.docx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("22")){
|
||||||
|
url = "http://39.98.140.126:8889/7.2.1-34/document/example.docx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("33")){
|
||||||
|
url = "http://10.100.5.116:8088//7.2.1-34/document/example.docx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("111")){
|
||||||
|
url = "http://47.92.92.38:8103/document/example.docx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("222")){
|
||||||
|
url = "http://39.98.140.126:8889/document/example.docx";
|
||||||
|
}
|
||||||
|
if(urlInfo.equals("333")){
|
||||||
|
url = "http://10.100.5.116:8088/document/example.docx";
|
||||||
|
}
|
||||||
|
|
||||||
|
//HttpGet httpGet=new HttpGet(url);
|
||||||
|
HttpPost httpPost=new HttpPost(url);
|
||||||
|
JSONObject jsonObject = null;
|
||||||
|
try {
|
||||||
|
httpPost.setHeader("Accept","application/json");
|
||||||
|
httpPost.setHeader("Content-Type","Content-Type");
|
||||||
|
HttpResponse res = client.execute(httpPost);
|
||||||
|
if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||||
|
// 返回json格式:
|
||||||
|
jsonObject = JSONObject.parseObject(EntityUtils.toString(res.getEntity()));
|
||||||
|
Object fileUrl = jsonObject.get("fileUrl");
|
||||||
|
logger.info("==============================================================="+jsonObject.toJSONString());
|
||||||
|
if(fileUrl!=null){
|
||||||
|
String urlStr = fileUrl.toString();
|
||||||
|
if(StringUtils.isNotBlank(urlStr)){
|
||||||
|
File file = new File(urlStr);
|
||||||
|
if(file.exists()){
|
||||||
|
AttFileVo attFileVo = iAttFileEOService.saveFileInfo(file);
|
||||||
|
if(attFileVo!=null){
|
||||||
|
logger.info("==============================================================="+attFileVo);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.info("===============================================================路径"+urlStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("==============================================================="+jsonObject.toJSONString());
|
||||||
|
}
|
||||||
|
System.out.println(jsonObject);
|
||||||
|
}else {
|
||||||
|
jsonObject.put("fileUrl","失败!!!!!!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("服务间接口调用出错!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return jsonObject.toJSONString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,306 @@
|
|||||||
|
package com.adc.da.utils.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.http.Result;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
|
import org.apache.http.client.config.RequestConfig;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class OnlyofficePdfUtil {
|
||||||
|
|
||||||
|
public static ResponseMessage downloadFile(String filePathInfo,String filePdfName, String key, String onlineFilePath) throws Exception {
|
||||||
|
|
||||||
|
String filePath = filePathInfo+"/onlineFile/"+filePdfName;
|
||||||
|
|
||||||
|
System.out.println("================"+filePath);
|
||||||
|
|
||||||
|
String fileUrl = convertFile(key,onlineFilePath);
|
||||||
|
|
||||||
|
System.out.println("=============================="+fileUrl);
|
||||||
|
|
||||||
|
// 创建HttpClientBuilder
|
||||||
|
|
||||||
|
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||||
|
|
||||||
|
// HttpClient
|
||||||
|
|
||||||
|
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
|
||||||
|
|
||||||
|
HttpGet get = new HttpGet(fileUrl);
|
||||||
|
|
||||||
|
// 设置请求和传输超时时间
|
||||||
|
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
|
||||||
|
.setSocketTimeout(60000)
|
||||||
|
|
||||||
|
.setConnectionRequestTimeout(60000)
|
||||||
|
|
||||||
|
.setConnectTimeout(60000)
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
get.setConfig(requestConfig);
|
||||||
|
|
||||||
|
CloseableHttpResponse response = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
//发送get请求
|
||||||
|
|
||||||
|
response = closeableHttpClient.execute(get);
|
||||||
|
|
||||||
|
if (response == null || response.getStatusLine() == null) {
|
||||||
|
|
||||||
|
throw new Exception("发送GET请求失败,返回结果为空!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回状态是否200
|
||||||
|
|
||||||
|
int statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
|
||||||
|
if (statusCode == HttpStatus.SC_OK) {
|
||||||
|
|
||||||
|
//得到请求结果
|
||||||
|
|
||||||
|
HttpEntity entityRes = response.getEntity();
|
||||||
|
|
||||||
|
if (entityRes != null) {
|
||||||
|
|
||||||
|
InputStream content = entityRes.getContent();
|
||||||
|
|
||||||
|
byte[] getData = readInputStream(content);
|
||||||
|
|
||||||
|
File file = new File(filePath);
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
|
||||||
|
fos.write(getData);
|
||||||
|
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
throw new Exception("发送GET请求出错:" + response);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
throw new Exception("发送GET请求出现异常," + e.getMessage());
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 关闭连接释放资源
|
||||||
|
|
||||||
|
if (response != null) {
|
||||||
|
|
||||||
|
response.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closeableHttpClient != null) {
|
||||||
|
|
||||||
|
closeableHttpClient.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String analysisXML(String xmlString) throws DocumentException {
|
||||||
|
|
||||||
|
Document document = DocumentHelper.parseText(xmlString);
|
||||||
|
|
||||||
|
Element rootElement = document.getRootElement();
|
||||||
|
|
||||||
|
String fileUrl = rootElement.elementText("FileUrl");
|
||||||
|
|
||||||
|
String newFileUrl = fileUrl.replaceAll("&", "&");
|
||||||
|
|
||||||
|
return newFileUrl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertFile(String key, String onlineFilePath) throws Exception{
|
||||||
|
|
||||||
|
String url = "http://47.92.92.38:8103/7.2.1-34/ConvertService.ashx";
|
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
map.put("async",false);
|
||||||
|
|
||||||
|
map.put("filetype","docx");
|
||||||
|
|
||||||
|
map.put("key",key);
|
||||||
|
|
||||||
|
map.put("outputtype","pdf");
|
||||||
|
|
||||||
|
map.put("title","test.pdf");
|
||||||
|
map.put("url","https://srms.foton.com.cn/file/"+onlineFilePath);
|
||||||
|
//map.put("url","https://srms.foton.com.cn/file/model/task_768330d8/task_768330d8_top_768330d8_node.docx");
|
||||||
|
|
||||||
|
JSONObject requestJson = new JSONObject(map);
|
||||||
|
|
||||||
|
// 创建HttpClientBuilder
|
||||||
|
|
||||||
|
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||||
|
|
||||||
|
// HttpClient
|
||||||
|
|
||||||
|
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
|
||||||
|
|
||||||
|
HttpPost httpPost = new HttpPost(url);
|
||||||
|
|
||||||
|
// 设置请求和传输超时时间
|
||||||
|
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
|
||||||
|
.setSocketTimeout(60000)
|
||||||
|
|
||||||
|
.setConnectionRequestTimeout(60000)
|
||||||
|
|
||||||
|
.setConnectTimeout(60000)
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
httpPost.setConfig(requestConfig);
|
||||||
|
|
||||||
|
CloseableHttpResponse response = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
//设置post请求方式为JSON
|
||||||
|
|
||||||
|
StringEntity data = new StringEntity(String.valueOf(requestJson), "UTF-8");
|
||||||
|
|
||||||
|
data.setContentType("application/json; charset=UTF-8");
|
||||||
|
|
||||||
|
httpPost.setEntity(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//发送post请求
|
||||||
|
|
||||||
|
response = closeableHttpClient.execute(httpPost);
|
||||||
|
|
||||||
|
if (response == null || response.getStatusLine() == null) {
|
||||||
|
|
||||||
|
throw new Exception("发送POST请求失败,返回结果为空!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//返回状态是否200
|
||||||
|
|
||||||
|
int statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
|
||||||
|
if (statusCode == HttpStatus.SC_OK) {
|
||||||
|
|
||||||
|
//得到请求结果
|
||||||
|
|
||||||
|
HttpEntity entityRes = response.getEntity();
|
||||||
|
|
||||||
|
if (entityRes != null) {
|
||||||
|
|
||||||
|
String responsetData = EntityUtils.toString(entityRes, "UTF-8");
|
||||||
|
|
||||||
|
String fileUrl = analysisXML(responsetData);
|
||||||
|
|
||||||
|
return fileUrl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
throw new Exception("发送POST-JSON请求出错:" + response);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
throw new Exception("发送POST请求出现异常," + e.getMessage());
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 关闭连接释放资源
|
||||||
|
|
||||||
|
if (response != null) {
|
||||||
|
|
||||||
|
response.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closeableHttpClient != null) {
|
||||||
|
|
||||||
|
closeableHttpClient.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] readInputStream(InputStream inputStream) throws IOException {
|
||||||
|
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
while((len = inputStream.read(buffer)) != -1) {
|
||||||
|
|
||||||
|
bos.write(buffer, 0, len);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bos.close();
|
||||||
|
|
||||||
|
return bos.toByteArray();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user