|
@@ -1,7 +1,9 @@
|
|
|
package com.huyi.flowable.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.huyi.flowable.BaseException;
|
|
|
import com.huyi.flowable.BaseResult;
|
|
|
+import com.huyi.flowable.annotation.Log;
|
|
|
import com.huyi.flowable.api.FlowModel;
|
|
|
import com.huyi.flowable.api.FlowProcess;
|
|
|
import com.huyi.flowable.api.FlowTask;
|
|
@@ -101,10 +103,11 @@ public class FlowController {
|
|
|
* @throws IOException 文件异常
|
|
|
* @throws JDOMException 格式化异常
|
|
|
*/
|
|
|
+ @Log
|
|
|
@RequestMapping(value = "uploadXml")
|
|
|
@ResponseBody
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Integer uploadXml(@RequestBody Map requestParam) throws IOException, JDOMException {
|
|
|
+ public BaseResult uploadXml(@RequestBody Map requestParam) throws JDOMException, BaseException, IOException {
|
|
|
// 文件名
|
|
|
String fileName = String.valueOf(requestParam.get("fileName"));
|
|
|
// xml内容
|
|
@@ -118,6 +121,9 @@ public class FlowController {
|
|
|
// 节点数据
|
|
|
List nodeFormList = (List)requestParam.get("nodeFormList");
|
|
|
|
|
|
+ // 数据校验
|
|
|
+ XmlUtil.checkUserTask(fileContent);
|
|
|
+
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
param.put("menuId", menuId);
|
|
|
param.put("companyId", companyId);
|
|
@@ -130,13 +136,14 @@ public class FlowController {
|
|
|
// 与其他流程的key重复
|
|
|
if (processDefinition != null) {
|
|
|
System.out.println("流程的key重复");
|
|
|
- return 0;
|
|
|
+ return new BaseResult("500", "流程的key重复", null);
|
|
|
}
|
|
|
File file = FileUtil.createFile(fileName, fileContent);
|
|
|
Deployment deployment = flowModel.deployFlowXml(file.getAbsolutePath());
|
|
|
boolean delete = file.delete();
|
|
|
if (!delete) {
|
|
|
System.out.println("文件删除失败!");
|
|
|
+ return new BaseResult("500", "文件删除失败!", null);
|
|
|
}
|
|
|
processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
|
|
|
|
|
@@ -161,7 +168,7 @@ public class FlowController {
|
|
|
Deployment deployment = flowModel.deployFlowXml(file.getAbsolutePath());
|
|
|
boolean delete = file.delete();
|
|
|
if (!delete) {
|
|
|
- System.out.println("文件删除失败!");
|
|
|
+ return new BaseResult("500", "文件删除失败!", null);
|
|
|
}
|
|
|
processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
|
|
|
|
|
@@ -188,7 +195,7 @@ public class FlowController {
|
|
|
nodeFormMapper.insertNodeForm(nodeJson);
|
|
|
}
|
|
|
}
|
|
|
- return 1;
|
|
|
+ return new BaseResult("200", "上传成功!", null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -345,6 +352,9 @@ public class FlowController {
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
param.put("excutionName", excutionName);
|
|
|
param.put("processDefName", processDefName);
|
|
|
+ System.out.println(flowTask);
|
|
|
+ System.out.println(loginUser);
|
|
|
+ System.out.println(loginUser.getSysUser());
|
|
|
Page<Map<String, Object>> page = flowTask.getMyTask(String.valueOf(loginUser.getSysUser().getUserId()), param, pageNum, pageSize);
|
|
|
return new BaseResult(page);
|
|
|
}
|