feat: There is no way the,
This commit is contained in:
@@ -19,6 +19,12 @@ import java.util.Set;
|
||||
//@FeignClient(value = "shan6")
|
||||
public interface workFlowFeignClient {
|
||||
|
||||
@RequestMapping(value = "/bat-wkflow/busProcessModel/processModelHisOneUpdStatus",method = RequestMethod.GET)
|
||||
BusProcessModelHis processModelHisOneUpdStatus(@RequestParam("pid") String pid, @RequestParam("taskId") String taskId);
|
||||
|
||||
@RequestMapping(value = "/bat-wkflow/busProcessModel/processModelHisOneCount",method = RequestMethod.GET)
|
||||
BusProcessModelHis processModelHisOneCount(@RequestParam("pid") String pid);
|
||||
|
||||
@RequestMapping(value = "/bat-wkflow/busProcessModel/processModelHisOne",method = RequestMethod.GET)
|
||||
BusProcessModelHis processModelHisOne(@RequestParam("pid") String pid, @RequestParam("taskId") String taskId);
|
||||
|
||||
|
||||
@@ -27,6 +27,16 @@ public class workFlowFeignClientImpl {
|
||||
@Autowired
|
||||
private IUserEOService userEOService;
|
||||
|
||||
public BusProcessModelHis processModelHisOneUpdStatus(@RequestParam("pid") String pid,@RequestParam("taskId") String taskId){
|
||||
BusProcessModelHis stringWrapper = workFlowFeignClient.processModelHisOneUpdStatus(pid,taskId);
|
||||
return stringWrapper;
|
||||
}
|
||||
|
||||
public BusProcessModelHis processModelHisOneCount(@RequestParam("pid") String pid){
|
||||
BusProcessModelHis stringWrapper = workFlowFeignClient.processModelHisOneCount(pid);
|
||||
return stringWrapper;
|
||||
}
|
||||
|
||||
public BusProcessModelHis processModelHisOne(@RequestParam("pid") String pid,@RequestParam("taskId") String taskId){
|
||||
BusProcessModelHis stringWrapper = workFlowFeignClient.processModelHisOne(pid,taskId);
|
||||
return stringWrapper;
|
||||
|
||||
+102
-3
@@ -25,14 +25,17 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -41,12 +44,108 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "福田标准法规-工作流管理")
|
||||
public class WorkFlowController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WorkFlowController.class);
|
||||
|
||||
@Autowired
|
||||
private workFlowFeignClientImpl workFlowFeignClient;
|
||||
|
||||
@Value("${stand.edit.file.path}")
|
||||
private String standEditFilePath;
|
||||
|
||||
// @Autowired
|
||||
// private ExportExcelMapper exportExcelMapper;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询在线编辑流程汇总文件编辑对象")
|
||||
@GetMapping("/processModelHisOneCount")
|
||||
public BusProcessModelHis processModelHisOneCount(@RequestParam("pid") String pid){
|
||||
return workFlowFeignClient.processModelHisOneCount(pid);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|onlyOffice接收文件")
|
||||
@PostMapping("/recieveFile")
|
||||
public void recieveFile(HttpServletRequest request, HttpServletResponse response, String fileNm,String standNo,String pid,String taskId){
|
||||
logger.info("**********进入onlyoffice接收文档接口************");
|
||||
try {
|
||||
PrintWriter writer = response.getWriter();
|
||||
String body = "";
|
||||
try {
|
||||
Scanner scanner = new Scanner(request.getInputStream());
|
||||
scanner.useDelimiter("\\A");
|
||||
body = scanner.hasNext() ? scanner.next() : "";
|
||||
scanner.close();
|
||||
} catch (Exception ex) {
|
||||
writer.write("get request.getInputStream error:" + ex.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (body.isEmpty()) {
|
||||
writer.write("empty request.getInputStream");
|
||||
return;
|
||||
}
|
||||
|
||||
net.sf.json.JSONObject jsonObj = net.sf.json.JSONObject.fromObject(body);
|
||||
logger.info("**********onlyoffice接收文档接口获得结果body************" + body);
|
||||
int status = (Integer) jsonObj.get("status");
|
||||
|
||||
int saved = 0;
|
||||
if (status == 2 || status == 3)//MustSave, Corrupted
|
||||
{
|
||||
String downloadUri = (String) jsonObj.get("url");
|
||||
|
||||
try {
|
||||
logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri);
|
||||
if (StringUtils.isNotEmpty(downloadUri)) {
|
||||
File file = new File(standEditFilePath + standNo + "\\" + fileNm);
|
||||
downloadNetFile(downloadUri, file);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
saved = 1;
|
||||
logger.info("**********onlyoffice接收文档接口异常************" + ex.getMessage());
|
||||
logger.error(ex.getMessage(),ex);
|
||||
}
|
||||
} else if (status == 4) {
|
||||
logger.info("**********onlyoffice接收文档接口开始修改文件状态状态4************");
|
||||
|
||||
logger.info("**********onlyoffice接收文档接口修改文件状态成功状态4************");
|
||||
}
|
||||
logger.info("onlyoffice编辑完成--------------");
|
||||
writer.write("{\"error\":" + saved + "}");
|
||||
|
||||
// 更新在线编辑当前节点编辑状态
|
||||
workFlowFeignClient.processModelHisOneUpdStatus(pid,taskId);
|
||||
} catch (IOException e) {
|
||||
logger.info("**********onlyoffice接收文档接口异常************" + e.getMessage());
|
||||
logger.error(e.getMessage(),e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadNetFile(String downloadUrl, File file) {
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||
URL url = new URL(downloadUrl);
|
||||
URLConnection connection = url.openConnection();
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
int length = 0;
|
||||
byte[] bytes = new byte[1024];
|
||||
while ((length = inputStream.read(bytes)) != -1) {
|
||||
fileOutputStream.write(bytes, 0, length);
|
||||
}
|
||||
fileOutputStream.close();
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("download error ! url :{}, exception:{}", downloadUrl, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新在线编辑流程当前节点编辑状态")
|
||||
@GetMapping("/processModelHisOneUpd")
|
||||
public BusProcessModelHis processModelHisOneUpd(@RequestParam("pid") String pid,@RequestParam("taskId") String taskId){
|
||||
return workFlowFeignClient.processModelHisOneUpdStatus(pid,taskId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询在线编辑流程当前节点编辑对象")
|
||||
@GetMapping("/processModelHisOne")
|
||||
public BusProcessModelHis processModelHisOne(@RequestParam("pid") String pid,@RequestParam("taskId") String taskId){
|
||||
|
||||
@@ -78,6 +78,10 @@ public class BusProcessModelHis implements Serializable {
|
||||
@TableField("EDIT_FILE_PATH")
|
||||
private String editFilePath;
|
||||
|
||||
@ApiModelProperty(value = "onlyOffice 编辑类型 node 节点编辑 count 汇总编辑")
|
||||
@TableField("EDIT_TYPE")
|
||||
private String editType;
|
||||
|
||||
@ApiModelProperty(value = "逻辑状态")
|
||||
@TableField("FLAG")
|
||||
private String flag;
|
||||
|
||||
@@ -64,7 +64,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
//文件预览
|
||||
addInterceptor.excludePathPatterns("/api/att/attFile/getFileInfo");
|
||||
// onlyOffice 回调
|
||||
addInterceptor.excludePathPatterns("/api/att/attFile/recieveFile");
|
||||
addInterceptor.excludePathPatterns("/api/lawss/activiti/recieveFile");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/lawss/activiti/processModelHisOne");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/lawss/activiti/processModelHisOneCount");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/att/attFile/getSyncPdfFileInfo");
|
||||
//附件下载
|
||||
|
||||
@@ -59,9 +59,6 @@ public class AttFileEOController {
|
||||
@Value("${file.path}")
|
||||
private String filePath;//文件存储路径
|
||||
|
||||
@Value("${stand.edit.file.path}")
|
||||
private String standEditFilePath;
|
||||
|
||||
// @Autowired
|
||||
// private RoleEOService roleEOService;
|
||||
//
|
||||
@@ -79,82 +76,6 @@ public class AttFileEOController {
|
||||
return Result.success(attFileEO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|onlyOffice接收文件")
|
||||
@PostMapping("/recieveFile")
|
||||
public void recieveFile(HttpServletRequest request, HttpServletResponse response, String fileNm,String standNo){
|
||||
logger.info("**********进入onlyoffice接收文档接口************");
|
||||
try {
|
||||
PrintWriter writer = response.getWriter();
|
||||
String body = "";
|
||||
try {
|
||||
Scanner scanner = new Scanner(request.getInputStream());
|
||||
scanner.useDelimiter("\\A");
|
||||
body = scanner.hasNext() ? scanner.next() : "";
|
||||
scanner.close();
|
||||
} catch (Exception ex) {
|
||||
writer.write("get request.getInputStream error:" + ex.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (body.isEmpty()) {
|
||||
writer.write("empty request.getInputStream");
|
||||
return;
|
||||
}
|
||||
|
||||
net.sf.json.JSONObject jsonObj = net.sf.json.JSONObject.fromObject(body);
|
||||
logger.info("**********onlyoffice接收文档接口获得结果body************" + body);
|
||||
int status = (Integer) jsonObj.get("status");
|
||||
|
||||
int saved = 0;
|
||||
if (status == 2 || status == 3)//MustSave, Corrupted
|
||||
{
|
||||
String downloadUri = (String) jsonObj.get("url");
|
||||
|
||||
try {
|
||||
logger.info("**********onlyoffice接收文档接口获得downloadUri************" + downloadUri);
|
||||
if (StringUtils.isNotEmpty(downloadUri)) {
|
||||
File file = new File(standEditFilePath + standNo + "\\" + fileNm);
|
||||
downloadNetFile(downloadUri, file);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
saved = 1;
|
||||
logger.info("**********onlyoffice接收文档接口异常************" + ex.getMessage());
|
||||
logger.error(ex.getMessage(),ex);
|
||||
}
|
||||
} else if (status == 4) {
|
||||
logger.info("**********onlyoffice接收文档接口开始修改文件状态状态4************");
|
||||
|
||||
logger.info("**********onlyoffice接收文档接口修改文件状态成功状态4************");
|
||||
}
|
||||
logger.info("onlyoffice编辑完成--------------");
|
||||
writer.write("{\"error\":" + saved + "}");
|
||||
} catch (IOException e) {
|
||||
logger.info("**********onlyoffice接收文档接口异常************" + e.getMessage());
|
||||
logger.error(e.getMessage(),e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadNetFile(String downloadUrl, File file) {
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||
URL url = new URL(downloadUrl);
|
||||
URLConnection connection = url.openConnection();
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
int length = 0;
|
||||
byte[] bytes = new byte[1024];
|
||||
while ((length = inputStream.read(bytes)) != -1) {
|
||||
fileOutputStream.write(bytes, 0, length);
|
||||
}
|
||||
fileOutputStream.close();
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("download error ! url :{}, exception:{}", downloadUrl, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="|File|上传文件")
|
||||
@PostMapping(value="/upload",consumes="multipart/*",headers="content-type=multipart/form-data" )
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
|
||||
Reference in New Issue
Block a user