style: 在线编辑代码整理
This commit is contained in:
+59
-37
@@ -1,6 +1,7 @@
|
|||||||
package com.jero.modules.onlyoffice.controller;
|
package com.jero.modules.onlyoffice.controller;
|
||||||
|
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -12,6 +13,7 @@ import com.jero.common.util.oConvertUtils;
|
|||||||
import com.jero.modules.onlyoffice.entity.BusProcessModelHis;
|
import com.jero.modules.onlyoffice.entity.BusProcessModelHis;
|
||||||
import com.jero.modules.onlyoffice.entity.OnlineFileLog;
|
import com.jero.modules.onlyoffice.entity.OnlineFileLog;
|
||||||
import com.jero.modules.onlyoffice.mapper.BusProcessModelHisMapper;
|
import com.jero.modules.onlyoffice.mapper.BusProcessModelHisMapper;
|
||||||
|
import com.jero.modules.onlyoffice.mapper.OnlineFileLogDao;
|
||||||
import com.jero.modules.onlyoffice.service.IBusProcessModelHisService;
|
import com.jero.modules.onlyoffice.service.IBusProcessModelHisService;
|
||||||
import com.jero.modules.onlyoffice.service.LawsUserInfoService;
|
import com.jero.modules.onlyoffice.service.LawsUserInfoService;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
@@ -21,7 +23,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.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.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -33,41 +34,44 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.Arrays;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* onlyoffice前端控制器
|
* onlyoffice前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Api(tags="onlyoffice操作")
|
@Api(tags = "onlyOffice操作")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/onlyoffice")
|
@RequestMapping("/onlyOffice")
|
||||||
public class OnlyofficeController {
|
public class OnlyOfficeController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(OnlyofficeController.class);
|
private static final Logger logger = LoggerFactory.getLogger(OnlyOfficeController.class);
|
||||||
|
|
||||||
@Value("${file.path}")
|
@Value("${file.path}")
|
||||||
private String standEditFilePath;//文件存储路径
|
private String standEditFilePath;//文件存储路径
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private IBusProcessModelHisService busProcessModelHisService;
|
private IBusProcessModelHisService busProcessModelHisService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private LawsUserInfoService lawsUserInfoService;
|
private LawsUserInfoService lawsUserInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BusProcessModelHisMapper busProcessModelHisMapper;
|
private BusProcessModelHisMapper busProcessModelHisMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private IOSSFileService ossFileService;
|
private IOSSFileService ossFileService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OnlineFileLogDao onlineFileLogDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件后缀黑名单
|
* 文件后缀黑名单
|
||||||
*/
|
*/
|
||||||
@Value(value = "${jero.fileSuffixLimits}")
|
@Value(value = "${jero.fileSuffixLimits}")
|
||||||
private String[] fileSuffixLimits;
|
private String[] fileSuffixLimits;
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
@ApiOperation(value = "分页查询")
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis,
|
public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis,
|
||||||
@@ -78,6 +82,7 @@ public class OnlyofficeController {
|
|||||||
IPage<BusProcessModelHis> pageList = busProcessModelHisService.page(page, queryWrapper);
|
IPage<BusProcessModelHis> pageList = busProcessModelHisService.page(page, queryWrapper);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@@ -112,9 +117,9 @@ public class OnlyofficeController {
|
|||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "|onlyOffice接收文件")
|
@ApiOperation(value = "|onlyOffice接收文件")
|
||||||
@PostMapping("/recieveFile")
|
@PostMapping("/receiveFile")
|
||||||
public void recieveFile(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String fileId,String standName,String key){
|
public void receiveFile(HttpServletRequest request, HttpServletResponse response, String fileNm, String standNo, String fileId, String standName, String key) {
|
||||||
logger.info("**********进入recieveFile接收文档接口************");
|
logger.info("**********进入receiveFile接收文档接口************");
|
||||||
logger.info("**********fileNm************" + fileNm + "=======");
|
logger.info("**********fileNm************" + fileNm + "=======");
|
||||||
logger.info("**********standNo************" + standNo + "=======");
|
logger.info("**********standNo************" + standNo + "=======");
|
||||||
logger.info("**********fileId************" + fileId + "=======");
|
logger.info("**********fileId************" + fileId + "=======");
|
||||||
@@ -154,10 +159,8 @@ public class OnlyofficeController {
|
|||||||
downloadUri = downloadUri.replace("onlyoffice.sinotruk.com", "onlyoffice-sa2of.yf-grp:8080");
|
downloadUri = downloadUri.replace("onlyoffice.sinotruk.com", "onlyoffice-sa2of.yf-grp:8080");
|
||||||
BusProcessModelHis modelHis = busProcessModelHisService.getById(fileId);
|
BusProcessModelHis modelHis = busProcessModelHisService.getById(fileId);
|
||||||
String editFilePath = modelHis.getEditFilePath();
|
String editFilePath = modelHis.getEditFilePath();
|
||||||
StringBuilder builder=new StringBuilder();
|
String saveFileUrl = standEditFilePath +
|
||||||
builder.append(standEditFilePath);
|
editFilePath;
|
||||||
builder.append(editFilePath);
|
|
||||||
String saveFileUrl = builder.toString();
|
|
||||||
logger.info("**********onlyoffice文档下载路径************" + downloadUri);
|
logger.info("**********onlyoffice文档下载路径************" + downloadUri);
|
||||||
logger.info("**********onlyoffice文档保存本地路径************" + saveFileUrl);
|
logger.info("**********onlyoffice文档保存本地路径************" + saveFileUrl);
|
||||||
HttpUtil.downloadFileFromUrl(downloadUri, saveFileUrl);
|
HttpUtil.downloadFileFromUrl(downloadUri, saveFileUrl);
|
||||||
@@ -193,9 +196,9 @@ public class OnlyofficeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "|onlyOffice接收文件")
|
@ApiOperation(value = "|onlyOffice接收文件")
|
||||||
@PostMapping("/recieveFileBefore")
|
@PostMapping("/receiveFileBefore")
|
||||||
public void recieveFileBefore(HttpServletRequest request, HttpServletResponse response,String key, String fileNm, String standNo, String pid, String taskId ,String standName){
|
public void receiveFileBefore(HttpServletRequest request, HttpServletResponse response, String key, String fileNm, String standNo, String pid, String taskId, String standName) {
|
||||||
logger.info("**********进入recieveFileBefore接收文档接口************");
|
logger.info("**********进入receiveFileBefore接收文档接口************");
|
||||||
logger.info("**********fileNm************" + fileNm + "=======");
|
logger.info("**********fileNm************" + fileNm + "=======");
|
||||||
logger.info("**********standNo************" + standNo + "=======");
|
logger.info("**********standNo************" + standNo + "=======");
|
||||||
logger.info("**********pid************" + pid + "=======");
|
logger.info("**********pid************" + pid + "=======");
|
||||||
@@ -233,11 +236,9 @@ public class OnlyofficeController {
|
|||||||
try {
|
try {
|
||||||
logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri);
|
logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri);
|
||||||
if (StringUtils.isNotEmpty(downloadUri)) {
|
if (StringUtils.isNotEmpty(downloadUri)) {
|
||||||
StringBuilder builder=new StringBuilder();
|
String saveFileUrl = standEditFilePath +
|
||||||
builder.append(standEditFilePath);
|
standNo + "/" +
|
||||||
builder.append(standNo).append("/");
|
fileNm;
|
||||||
builder.append(fileNm);
|
|
||||||
String saveFileUrl = builder.toString();
|
|
||||||
File file = new File(saveFileUrl);
|
File file = new File(saveFileUrl);
|
||||||
downloadNetFile(downloadUri, file);
|
downloadNetFile(downloadUri, file);
|
||||||
// 更新在线编辑当前节点编辑状态
|
// 更新在线编辑当前节点编辑状态
|
||||||
@@ -271,7 +272,6 @@ public class OnlyofficeController {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.info("**********onlyoffice接收文档接口异常************" + e.getMessage());
|
logger.info("**********onlyoffice接收文档接口异常************" + e.getMessage());
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,8 +295,7 @@ public class OnlyofficeController {
|
|||||||
|
|
||||||
@GetMapping("/processEditFile")
|
@GetMapping("/processEditFile")
|
||||||
public BusProcessModelHis processEditFile(String id) {
|
public BusProcessModelHis processEditFile(String id) {
|
||||||
BusProcessModelHis modelHisOne = busProcessModelHisService.processEditFile(id);
|
return busProcessModelHisService.processEditFile(id);
|
||||||
return modelHisOne;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "|model| 传入 模板文档名称(不带后缀)默认 docx")
|
@ApiOperation(value = "|model| 传入 模板文档名称(不带后缀)默认 docx")
|
||||||
@@ -314,26 +313,22 @@ public class OnlyofficeController {
|
|||||||
|
|
||||||
@GetMapping("/processModelHisOneUpdStatus")
|
@GetMapping("/processModelHisOneUpdStatus")
|
||||||
public BusProcessModelHis modelHisOneUpdStatus(String pid, String taskId) {
|
public BusProcessModelHis modelHisOneUpdStatus(String pid, String taskId) {
|
||||||
BusProcessModelHis modelHisOne = busProcessModelHisService.modelHisOneUpdStatus(pid,taskId);
|
return busProcessModelHisService.modelHisOneUpdStatus(pid, taskId);
|
||||||
return modelHisOne;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/processModelHisOneCount")
|
@GetMapping("/processModelHisOneCount")
|
||||||
public BusProcessModelHis modelHisOneCount(String pid) {
|
public BusProcessModelHis modelHisOneCount(String pid) {
|
||||||
BusProcessModelHis modelHisOne = busProcessModelHisService.modelHisOneCount(pid);
|
return busProcessModelHisService.modelHisOneCount(pid);
|
||||||
return modelHisOne;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/processModelHisOne")
|
@GetMapping("/processModelHisOne")
|
||||||
public BusProcessModelHis modelHisOne(String pid, String taskId) {
|
public BusProcessModelHis modelHisOne(String pid, String taskId) {
|
||||||
BusProcessModelHis modelHisOne = busProcessModelHisService.modelHisOne(pid,taskId);
|
return busProcessModelHisService.modelHisOne(pid, taskId);
|
||||||
return modelHisOne;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/processModelHisList")
|
@GetMapping("/processModelHisList")
|
||||||
public List<BusProcessModelHis> evaluationHisList(String pid) {
|
public List<BusProcessModelHis> evaluationHisList(String pid) {
|
||||||
List<BusProcessModelHis> processModelHisList = busProcessModelHisService.modelHisList(pid);
|
return busProcessModelHisService.modelHisList(pid);
|
||||||
return processModelHisList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/selectOnlineFile")
|
@PostMapping("/selectOnlineFile")
|
||||||
@@ -341,8 +336,35 @@ public class OnlyofficeController {
|
|||||||
return busProcessModelHisService.selectOnlineFile(onlineFileId);
|
return busProcessModelHisService.selectOnlineFile(onlineFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据在线文件Id查询所有onlyoffice历史文件")
|
||||||
|
@GetMapping("/getAllOnlyOfficeHisFileById")
|
||||||
|
public Result<List<Map<String, String>>> getAllOnlyOfficeHisFileById(String fileId, String fileName) {
|
||||||
|
List<Map<String, String>> fileList = new ArrayList<>();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LambdaQueryWrapper<OnlineFileLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(OnlineFileLog::getHisId, fileId);
|
||||||
|
wrapper.eq(OnlineFileLog::getValidFlag, "0");
|
||||||
|
wrapper.orderByDesc(OnlineFileLog::getCreateTime);
|
||||||
|
List<OnlineFileLog> onlineFileLogList = onlineFileLogDao.selectList(wrapper);
|
||||||
|
if (!onlineFileLogList.isEmpty()) {
|
||||||
|
for (OnlineFileLog onlineFileLog : onlineFileLogList) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("id", onlineFileLog.getId());
|
||||||
|
map.put("fileName", fileName);
|
||||||
|
map.put("attFileId", onlineFileLog.getAttFileId());
|
||||||
|
map.put("createTime", sdf.format(onlineFileLog.getCreateTime()));
|
||||||
|
map.put("fileKey", onlineFileLog.getFileKey());
|
||||||
|
fileList.add(map);
|
||||||
|
}
|
||||||
|
return Result.OK(fileList);
|
||||||
|
}
|
||||||
|
return Result.error("历史文件为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传统一方法
|
* 文件上传统一方法
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
@@ -57,15 +57,24 @@ public class AttFileEO implements Serializable{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
switch (fieldName) {
|
switch (fieldName) {
|
||||||
case "id": return "id";
|
case "id":
|
||||||
case "fileName": return "file_name";
|
return "id";
|
||||||
case "oldFileName": return "old_file_name";
|
case "fileName":
|
||||||
case "fileSuffix": return "file_suffix";
|
return "file_name";
|
||||||
case "filePath": return "file_path";
|
case "oldFileName":
|
||||||
case "validFlag": return "valid_flag";
|
return "old_file_name";
|
||||||
case "creationTime": return "creation_time";
|
case "fileSuffix":
|
||||||
case "modifyTime": return "modify_time";
|
return "file_suffix";
|
||||||
default: return null;
|
case "filePath":
|
||||||
|
return "file_path";
|
||||||
|
case "validFlag":
|
||||||
|
return "valid_flag";
|
||||||
|
case "creationTime":
|
||||||
|
return "creation_time";
|
||||||
|
case "modifyTime":
|
||||||
|
return "modify_time";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,19 +95,30 @@ public class AttFileEO implements Serializable{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
switch (columnName) {
|
switch (columnName) {
|
||||||
case "id": return "id";
|
case "id":
|
||||||
case "file_name": return "fileName";
|
return "id";
|
||||||
case "old_file_name": return "oldFileName";
|
case "file_name":
|
||||||
case "file_suffix": return "fileSuffix";
|
return "fileName";
|
||||||
case "file_path": return "filePath";
|
case "old_file_name":
|
||||||
case "valid_flag": return "validFlag";
|
return "oldFileName";
|
||||||
case "creation_time": return "creationTime";
|
case "file_suffix":
|
||||||
case "modify_time": return "modifyTime";
|
return "fileSuffix";
|
||||||
default: return null;
|
case "file_path":
|
||||||
|
return "filePath";
|
||||||
|
case "valid_flag":
|
||||||
|
return "validFlag";
|
||||||
|
case "creation_time":
|
||||||
|
return "creationTime";
|
||||||
|
case "modify_time":
|
||||||
|
return "modifyTime";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
int tableNameIndex = this.id.lastIndexOf("_");
|
int tableNameIndex = this.id.lastIndexOf("_");
|
||||||
if (tableNameIndex != -1) {
|
if (tableNameIndex != -1) {
|
||||||
@@ -110,7 +130,9 @@ public class AttFileEO implements Serializable{
|
|||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
if (tableName != null && !tableName.isEmpty()) {
|
if (tableName != null && !tableName.isEmpty()) {
|
||||||
this.id = tableName + "_" + id;
|
this.id = tableName + "_" + id;
|
||||||
@@ -119,72 +141,100 @@ public class AttFileEO implements Serializable{
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return this.fileName;
|
return this.fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setFileName(String fileName) {
|
public void setFileName(String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public String getOldFileName() {
|
public String getOldFileName() {
|
||||||
return this.oldFileName;
|
return this.oldFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setOldFileName(String oldFileName) {
|
public void setOldFileName(String oldFileName) {
|
||||||
this.oldFileName = oldFileName;
|
this.oldFileName = oldFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public String getFileSuffix() {
|
public String getFileSuffix() {
|
||||||
return this.fileSuffix;
|
return this.fileSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setFileSuffix(String fileSuffix) {
|
public void setFileSuffix(String fileSuffix) {
|
||||||
this.fileSuffix = fileSuffix;
|
this.fileSuffix = fileSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public String getFilePath() {
|
public String getFilePath() {
|
||||||
return this.filePath;
|
return this.filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setFilePath(String filePath) {
|
public void setFilePath(String filePath) {
|
||||||
this.filePath = filePath;
|
this.filePath = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public Integer getValidFlag() {
|
public Integer getValidFlag() {
|
||||||
return this.validFlag;
|
return this.validFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setValidFlag(Integer validFlag) {
|
public void setValidFlag(Integer validFlag) {
|
||||||
this.validFlag = validFlag;
|
this.validFlag = validFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public Date getCreationTime() {
|
public Date getCreationTime() {
|
||||||
return this.creationTime;
|
return this.creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setCreationTime(Date creationTime) {
|
public void setCreationTime(Date creationTime) {
|
||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public Date getModifyTime() {
|
public Date getModifyTime() {
|
||||||
return this.modifyTime;
|
return this.modifyTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/**
|
||||||
|
*
|
||||||
|
**/
|
||||||
public void setModifyTime(Date modifyTime) {
|
public void setModifyTime(Date modifyTime) {
|
||||||
this.modifyTime = modifyTime;
|
this.modifyTime = modifyTime;
|
||||||
}
|
}
|
||||||
|
|||||||
-16
@@ -166,20 +166,4 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyFile1(String srcPath, String destPath) throws IOException {
|
|
||||||
// 打开输入流
|
|
||||||
FileInputStream fis = new FileInputStream(srcPath);
|
|
||||||
// 打开输出流
|
|
||||||
FileOutputStream fos = new FileOutputStream(destPath);
|
|
||||||
// 读取和写入信息
|
|
||||||
int len = 0;
|
|
||||||
while ((len = fis.read()) != -1) {
|
|
||||||
fos.write(len);
|
|
||||||
}
|
|
||||||
// 关闭流 先开后关 后开先关
|
|
||||||
fos.close(); // 后开先关
|
|
||||||
fis.close(); // 先开后关
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -2,6 +2,7 @@ package com.jero.modules.onlyoffice.service.impl;
|
|||||||
|
|
||||||
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 com.jero.common.util.MinioUtil;
|
||||||
import com.jero.modules.onlyoffice.entity.BusProcessModelHis;
|
import com.jero.modules.onlyoffice.entity.BusProcessModelHis;
|
||||||
import com.jero.modules.onlyoffice.entity.OnlineFileLog;
|
import com.jero.modules.onlyoffice.entity.OnlineFileLog;
|
||||||
import com.jero.modules.onlyoffice.mapper.BusProcessModelHisMapper;
|
import com.jero.modules.onlyoffice.mapper.BusProcessModelHisMapper;
|
||||||
@@ -13,10 +14,11 @@ import org.slf4j.LoggerFactory;
|
|||||||
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 javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -46,11 +48,13 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
|||||||
@Value("${file.sourceFilePath}")
|
@Value("${file.sourceFilePath}")
|
||||||
private String sourceFilePath;
|
private String sourceFilePath;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BusProcessModelHis saveEditFile(String model) {
|
public BusProcessModelHis saveEditFile(String model) {
|
||||||
BusProcessModelHis modelHis = new BusProcessModelHis();
|
BusProcessModelHis modelHis = new BusProcessModelHis();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String preUuid2 = UUID.randomUUID().toString();
|
String preUuid2 = UUID.randomUUID().toString();
|
||||||
String changUuid = preUuid2.substring(0, 8);
|
String changUuid = preUuid2.substring(0, 8);
|
||||||
String taskId = "task_" + changUuid;
|
String taskId = "task_" + changUuid;
|
||||||
@@ -60,7 +64,6 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
|||||||
builderModel.append("model").append("/");
|
builderModel.append("model").append("/");
|
||||||
builderModel.append("model").append("/");
|
builderModel.append("model").append("/");
|
||||||
|
|
||||||
|
|
||||||
File dir = new File(filePath + builderModel.toString());
|
File dir = new File(filePath + builderModel.toString());
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
@@ -136,7 +139,7 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
|||||||
OutputStream outputStream = null;
|
OutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
File file = new File(filePath + path);
|
File file = new File(filePath + path);
|
||||||
inputStream = new BufferedInputStream(new FileInputStream(file));
|
inputStream = new BufferedInputStream(Files.newInputStream(file.toPath()));
|
||||||
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"), "iso-8859-1"));
|
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"), "iso-8859-1"));
|
||||||
response.setContentType("application/force-download");// 设置强制下载不打开
|
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||||
outputStream = response.getOutputStream();
|
outputStream = response.getOutputStream();
|
||||||
@@ -149,7 +152,6 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("预览文件失败" + e.getMessage());
|
log.error("预览文件失败" + e.getMessage());
|
||||||
response.setStatus(404);
|
response.setStatus(404);
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
} finally {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
@@ -171,6 +173,7 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 企标流程文件存储
|
* 企标流程文件存储
|
||||||
|
*
|
||||||
* @param pid
|
* @param pid
|
||||||
* @param taskId
|
* @param taskId
|
||||||
* @param fileSuffix
|
* @param fileSuffix
|
||||||
|
|||||||
Reference in New Issue
Block a user