Merge remote-tracking branch 'origin/develop_master' into develop_master
This commit is contained in:
+58
-15
@@ -38,6 +38,7 @@ import sun.misc.BASE64Encoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
@@ -57,6 +58,12 @@ public class WorkFlowController {
|
||||
@Value("${stand.edit.file.path}")
|
||||
private String standEditFilePath;
|
||||
|
||||
/**
|
||||
* 文件下载路径
|
||||
*/
|
||||
@Value("${file.downloadUrl}")
|
||||
private String downloadUrl;
|
||||
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
|
||||
@@ -71,23 +78,59 @@ public class WorkFlowController {
|
||||
// @RequiresPermissions("sys:file:downloadFileForSar")
|
||||
public void downloadFileForSar(String fileId, String oldFileName, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
BusProcessModelHis modelHisOne = workFlowFeignClient.processEditFile(fileId);
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
// fileUrl为http或https链接
|
||||
InputStream inputStream = null;
|
||||
HttpURLConnection conn = null;
|
||||
response.reset();
|
||||
try {
|
||||
String fileOldName = fileNameEncoding(oldFileName,request);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||
response.setContentType("application/octet-stream");
|
||||
File file = new File(standEditFilePath+modelHisOne.getEditFilePath());
|
||||
is = new FileInputStream(file);
|
||||
os = response.getOutputStream();
|
||||
org.apache.commons.io.IOUtils.copy(is, os);
|
||||
os.flush();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
} finally {
|
||||
org.apache.commons.io.IOUtils.closeQuietly(is);
|
||||
org.apache.commons.io.IOUtils.closeQuietly(os);
|
||||
File file = new File(downloadUrl+modelHisOne.getEditFilePath());
|
||||
|
||||
if(file.exists()){
|
||||
try {
|
||||
String fileOldName = fileNameEncoding(oldFileName,request);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||
response.setContentType("application/octet-stream");
|
||||
inputStream = new FileInputStream(file);
|
||||
os = response.getOutputStream();
|
||||
org.apache.commons.io.IOUtils.copy(inputStream, os);
|
||||
os.flush();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
} finally {
|
||||
org.apache.commons.io.IOUtils.closeQuietly(inputStream);
|
||||
org.apache.commons.io.IOUtils.closeQuietly(os);
|
||||
}
|
||||
}else {
|
||||
URL url;
|
||||
try {
|
||||
String fileOldName = fileNameEncoding(oldFileName,request);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||
response.setContentType("application/octet-stream");
|
||||
url = new URL(downloadUrl+modelHisOne.getEditFilePath());
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
// 设置超时间为5秒
|
||||
conn.setConnectTimeout(3 * 1000);
|
||||
// 得到输入流
|
||||
inputStream = conn.getInputStream();
|
||||
os = response.getOutputStream();
|
||||
IOUtils.copy(inputStream, os);
|
||||
os.flush();
|
||||
//生成本地文件之类的省略了
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
} finally {
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
IOUtils.closeQuietly(os);
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -116,16 +116,27 @@ public class EsRevisePlanServiceImpl extends ServiceImpl<EsRevisePlanDao, EsRevi
|
||||
|
||||
// 技术标准 更新计划库
|
||||
if(StringUtils.isNotBlank(esRevisePlan.getId())){
|
||||
EsRevisePlan upd = new EsRevisePlan();
|
||||
upd.setId(esRevisePlan.getId());
|
||||
String reviseStatus = "";
|
||||
if(StringUtils.isNotBlank(esRevisePlan.getReviseStatus())){
|
||||
if(esRevisePlan.getReviseStatus().contains("_")){
|
||||
reviseStatus = esRevisePlan.getReviseStatus().split("_")[1];
|
||||
}else {
|
||||
reviseStatus = esRevisePlan.getReviseStatus();
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(esRevisePlan.getPlanStatus()) || !"4".equals(esRevisePlan.getPlanStatus())){
|
||||
esRevisePlan.setReviseStatus(reviseStatus);
|
||||
if("1".equals(esRevisePlan.getReviseStatus())){
|
||||
esRevisePlan.setPlanStatus("1");
|
||||
upd.setPlanStatus("1");
|
||||
}else if("2".equals(esRevisePlan.getReviseStatus())){
|
||||
esRevisePlan.setPlanStatus("2");
|
||||
upd.setPlanStatus("2");
|
||||
}else if("3".equals(esRevisePlan.getReviseStatus())){
|
||||
esRevisePlan.setPlanStatus("3");
|
||||
upd.setPlanStatus("3");
|
||||
}
|
||||
}
|
||||
esRevisePlanDao.updateById(esRevisePlan);
|
||||
esRevisePlanDao.updateById(upd);
|
||||
}
|
||||
return "操作成功";
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
INSERT INTO `sar_stand_attr_details`(`ID`, `ATTR_FIELD`, `ATTR_NAME`, `ATTR_TYPE`, `ATTR_LEN`, `ORDER_NUM`, `IS_EDIT`, `CREATION_USER`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`, `IS_MUST`, `IS_SHOW_IMP`, `SHOW_REGION_ID`, `SEL_VAL`, `SAR_TYPE`, `IS_SEARCH`, `IS_WARN`, `IS_JANSUO`) VALUES ('vh9ywh0cs2kryho209lb', 'FBGYWBD', '发布稿(译文)', 'FILE', 2000, 4, '0', 'admin', '0', '2022-07-16 16:00:00', '2022-07-17 14:29:59', '1', '0', 'L378EYP5HL28KE7NSZ68', '', 'STAND', '1', '1', NULL);
|
||||
Reference in New Issue
Block a user