|
@@ -3,7 +3,9 @@ package org.jeecg.modules.activiti.web;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -29,8 +31,13 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.vo.ComboModel;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
+import org.jeecg.common.util.HttpUtils;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.activiti.entity.*;
|
|
|
import org.jeecg.modules.activiti.service.IActReModelService;
|
|
|
+import org.jeecg.modules.activiti.service.ITbTableInfoOuterService;
|
|
|
+import org.jeecg.modules.activiti.service.ITbTableInfoPracticeService;
|
|
|
import org.jeecg.modules.activiti.service.Impl.ActBusinessServiceImpl;
|
|
|
import org.jeecg.modules.activiti.service.Impl.ActZprocessServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -74,6 +81,10 @@ public class ActTaskController {
|
|
|
private IActReModelService iActReModelService;
|
|
|
@Autowired
|
|
|
ISysBaseAPI sysBaseAPI;
|
|
|
+ @Autowired
|
|
|
+ private ITbTableInfoOuterService tbTableInfoOuterService;
|
|
|
+ @Autowired
|
|
|
+ private ITbTableInfoPracticeService tbTableInfoPracticeService;
|
|
|
|
|
|
public void show(String userId,String name,String categoryId, Integer priority, HttpServletRequest request,List<Task> taskList){
|
|
|
TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
|
|
@@ -296,15 +307,38 @@ public class ActTaskController {
|
|
|
}
|
|
|
taskService.addComment(id, procInstId, comment);
|
|
|
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
|
|
+
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ // 异步发消息
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ // ----------- 获取外部表单回调 start,by fhf -------------
|
|
|
+ QueryWrapper<TbTableInfoOuter> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("text", actBusiness.getTableName());
|
|
|
+ TbTableInfoOuter tableInfoOuter = tbTableInfoOuterService.getOne(queryWrapper);
|
|
|
+ if (tableInfoOuter != null && oConvertUtils.isNotEmpty(tableInfoOuter.getSeturl())){
|
|
|
+ QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
|
|
|
+ practiceQueryWrapper.eq("id", actBusiness.getTableId());
|
|
|
+ TbTableInfoPractice tableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
|
|
|
+ if (tableInfoPractice != null) {
|
|
|
+ Task task = taskService.createTaskQuery().taskId(id).singleResult();
|
|
|
+ JSONObject jsonObject = JSON.parseObject(tableInfoPractice.getContent());
|
|
|
+ jsonObject.put("actionUser", sysUser.getRealname());
|
|
|
+ jsonObject.put("actionTime", DateUtils.date2Str(DateUtils.datetimeFormat.get()));
|
|
|
+ jsonObject.put("action", task.getName()+"驳回");
|
|
|
+ HttpUtils.sendJsonPost(tableInfoOuter.getSeturl(), jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // ----------- 获取外部表单回调 end,by fhf -------------
|
|
|
+
|
|
|
// 删除流程实例
|
|
|
runtimeService.deleteProcessInstance(procInstId, "backed");
|
|
|
- ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+
|
|
|
actBusiness.setStatus(ActivitiConstant.STATUS_FINISH);
|
|
|
actBusiness.setResult(ActivitiConstant.RESULT_FAIL);
|
|
|
actBusinessService.updateById(actBusiness);
|
|
|
|
|
|
- // 异步发消息
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
//我的消息跳转地址
|
|
|
Map<String,Object> map =new HashMap<>();
|
|
|
map.put("isUrl","1");
|
|
@@ -316,6 +350,9 @@ public class ActTaskController {
|
|
|
// 记录实际审批人员
|
|
|
actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
|
ActivitiConstant.EXECUTOR_TYPE, sysUser.getUsername(), id, procInstId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return Result.ok("操作成功");
|
|
|
}
|
|
|
/*流程流转历史*/
|
|
@@ -405,7 +442,7 @@ public class ActTaskController {
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
List<Task> tasks = taskService.createTaskQuery().processInstanceId(procInstId).list();
|
|
|
|
|
|
-
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
// 判断下一个节点
|
|
|
if(tasks!=null&&tasks.size()>0){
|
|
|
//修改公司id
|
|
@@ -420,7 +457,7 @@ public class ActTaskController {
|
|
|
// listTaskIdY.add(task.getId());
|
|
|
//修改已办公司id
|
|
|
iActReModelService.updateTaskInstPkOrgByIds(loginUser.getOrgCode(),listTaskId);
|
|
|
- ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+
|
|
|
for(Task t : tasks){
|
|
|
if(StrUtil.isBlank(assignees)){
|
|
|
// 如果下个节点未分配审批人为空 取消结束流程
|
|
@@ -469,7 +506,7 @@ public class ActTaskController {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ //ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
actBusiness.setStatus(ActivitiConstant.STATUS_FINISH);
|
|
|
actBusiness.setResult(ActivitiConstant.RESULT_PASS);
|
|
|
actBusinessService.updateById(actBusiness);
|
|
@@ -492,6 +529,25 @@ public class ActTaskController {
|
|
|
// 记录实际审批人员
|
|
|
actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
|
ActivitiConstant.EXECUTOR_TYPE, loginUser.getUsername(), id, procInstId);
|
|
|
+
|
|
|
+ // --------------- 获取外部表单回调 start, by fhf ---------------
|
|
|
+ QueryWrapper<TbTableInfoOuter> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("text", actBusiness.getTableName());
|
|
|
+ TbTableInfoOuter tableInfoOuter = tbTableInfoOuterService.getOne(queryWrapper);
|
|
|
+ if (tableInfoOuter != null && oConvertUtils.isNotEmpty(tableInfoOuter.getSeturl())){
|
|
|
+ QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
|
|
|
+ practiceQueryWrapper.eq("id", actBusiness.getTableId());
|
|
|
+ TbTableInfoPractice tableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
|
|
|
+ if (tableInfoPractice != null) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(tableInfoPractice.getContent());
|
|
|
+ jsonObject.put("actionUser", loginUser.getRealname());
|
|
|
+ jsonObject.put("actionTime", DateUtils.date2Str(DateUtils.datetimeFormat.get()));
|
|
|
+ jsonObject.put("action", task.getName());
|
|
|
+ HttpUtils.sendJsonPost(tableInfoOuter.getSeturl(), jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // --------------- 获取外部表单回调 end, by fhf ---------------
|
|
|
+
|
|
|
return Result.ok("操作成功");
|
|
|
}
|
|
|
@RequestMapping(value = "/delegate", method = RequestMethod.POST)
|
|
@@ -542,6 +598,28 @@ public class ActTaskController {
|
|
|
taskService.addComment(id, procInstId, comment);
|
|
|
// 取得流程定义
|
|
|
ProcessDefinitionEntity definition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(procDefId);
|
|
|
+
|
|
|
+ // ----------------获取外部表单回调 start, by fhf ------------
|
|
|
+ ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ QueryWrapper<TbTableInfoOuter> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("text", actBusiness.getTableName());
|
|
|
+ TbTableInfoOuter tableInfoOuter = tbTableInfoOuterService.getOne(queryWrapper);
|
|
|
+ if (tableInfoOuter != null && oConvertUtils.isNotEmpty(tableInfoOuter.getSeturl())){
|
|
|
+ QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
|
|
|
+ practiceQueryWrapper.eq("id", actBusiness.getTableId());
|
|
|
+ TbTableInfoPractice tableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
|
|
|
+ if (tableInfoPractice != null) {
|
|
|
+ Task task = taskService.createTaskQuery().taskId(id).singleResult();
|
|
|
+ JSONObject jsonObject = JSON.parseObject(tableInfoPractice.getContent());
|
|
|
+ jsonObject.put("actionUser", loginUser.getRealname());
|
|
|
+ jsonObject.put("actionTime", DateUtils.date2Str(DateUtils.datetimeFormat.get()));
|
|
|
+ jsonObject.put("action", task.getName()+"驳回");
|
|
|
+ HttpUtils.sendJsonPost(tableInfoOuter.getSeturl(), jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // ----------------获取外部表单回调 end, by fhf ------------
|
|
|
// 获取历史任务的Activity
|
|
|
ActivityImpl hisActivity = definition.findActivity(backTaskKey);
|
|
|
// 实现跳转
|
|
@@ -582,6 +660,9 @@ public class ActTaskController {
|
|
|
// 记录实际审批人员
|
|
|
actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
|
ActivitiConstant.EXECUTOR_TYPE, loginUser.getUsername(), id, procInstId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return Result.ok("操作成功");
|
|
|
}
|
|
|
|