Commit be741fa5 authored by 高建强's avatar 高建强

item:修改防火监督工作流执行

parent 887504c4
......@@ -31,12 +31,11 @@ public class PlanAuditController extends AbstractBaseController {
@RequestMapping(value = "/auditWorkFlow", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse auditWorkFlow(
@ApiParam(value = "工作流流水实例", required = true) @RequestBody PlanAuditLog planAuditLog,
@ApiParam(value = "工作流实例编号", required = true) @RequestParam String instanceId,
@ApiParam(value = "执行控制条件", required = true) @RequestParam String condition) {
try {
AgencyUserModel userInfo = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
return CommonResponseUtil.success(planAuditService.auditWorkFlow(planAuditLog, instanceId, condition, reginParams));
return CommonResponseUtil.success(planAuditService.auditWorkFlow(planAuditLog, condition, reginParams));
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("计划工作流审核失败!");
......
......@@ -7,4 +7,6 @@ import org.springframework.stereotype.Repository;
public interface IPlanAuditDao extends BaseDao<PlanAudit, Long> {
PlanAudit findByProcessInstanceId(String instanceId);
PlanAudit findByPlanId(Long planId);
}
\ No newline at end of file
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -11,7 +9,6 @@ import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService;
import com.yeejoin.amos.supervision.dao.entity.PlanAudit;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -35,38 +32,71 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Override
@Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String instanceId, String condition, ReginParams reginParams) {
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams) {
PlanAudit planAudit = planAuditDao.findByPlanId(planAuditLog.getPlanId());
if (ObjectUtils.isNotEmpty(planAudit)) {
String instanceId = planAudit.getProcessInstanceId();
Map<String, Object> taskAuthMap = workflowExcuteService.checkTaskAuthMap(instanceId);
if (taskAuthMap != null && !taskAuthMap.isEmpty()) {
String taskId = taskAuthMap.get("taskId").toString();
if (StringUtils.isNotBlank(taskId)) {
String name = taskAuthMap.get("name").toString();
String roleName = reginParams.getRole().getRoleName();
JSONObject taskGroupName = workflowFeignService.getTaskGroupName(taskId);
JSONArray taskGroupNameDetail = taskGroupName.getJSONArray("data");
// JSONObject taskGroupNameDetail = JSONObject.parseObject(JSONObject.toJSONString(data.get(data.size() - 2)));
if (!ObjectUtils.isEmpty(taskGroupNameDetail)) {
String defaultExecutionRoleProcess = taskGroupNameDetail.getJSONObject(0).getString("groupId");
}
boolean b = workflowExcuteService.CompleteTask(instanceId, condition);
if (b) {
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
workflowExcuteService.setTaskAssign(instanceId, personIdentity.getPersonSeq());
PlanAudit planAudit = planAuditDao.findByProcessInstanceId(instanceId);
if (ObjectUtils.isNotEmpty(planAudit)) {
planAuditLog.setPlanId(planAudit.getPlanId());
planAuditLog.setPlanAuditId(planAudit.getId());
planAuditLog.setExcuteUserId(personIdentity.getPersonSeq());
planAuditLog.setExcuteUserName(personIdentity.getPersonName());
// planAuditLog.setFlowTaskId();
// planAuditLog.setFlowTaskName();
planAuditLog.setFlowTaskId(taskId);
planAuditLog.setFlowTaskName(name);
planAuditLog.setFlowJson(condition);
planAuditLog.setRoleName(roleName);
planAuditLogDao.save(planAuditLog);
}
}
return b;
}
}
return Boolean.FALSE;
}
// @Override
// @Transactional
// public Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams) {
// PlanAudit planAudit = planAuditDao.findByPlanId(planAuditLog.getPlanId());
// Map<String, Object> taskAuthMap = workflowExcuteService.checkTaskAuthMap(instanceId);
// if (taskAuthMap != null && !taskAuthMap.isEmpty()) {
// String taskId = taskAuthMap.get("taskId").toString();
// String name = taskAuthMap.get("name").toString();
// if (StringUtils.isNotBlank(taskId)) {
// String roleName = reginParams.getRole().getRoleName();
//// JSONObject taskGroupName = workflowFeignService.getTaskGroupName(taskId);
//// JSONArray taskGroupNameDetail = taskGroupName.getJSONArray("data");
////// JSONObject taskGroupNameDetail = JSONObject.parseObject(JSONObject.toJSONString(data.get(data.size() - 2)));
//// if (!ObjectUtils.isEmpty(taskGroupNameDetail)) {
//// String defaultExecutionRoleProcess = taskGroupNameDetail.getJSONObject(0).getString("groupId");
//// }
// boolean b = workflowExcuteService.CompleteTask(instanceId, condition);
// if (b) {
// ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
// workflowExcuteService.setTaskAssign(instanceId, personIdentity.getPersonSeq());
//
// if (ObjectUtils.isNotEmpty(planAudit)) {
// planAuditLog.setPlanId(planAudit.getPlanId());
// planAuditLog.setPlanAuditId(planAudit.getId());
// planAuditLog.setExcuteUserId(personIdentity.getPersonSeq());
// planAuditLog.setExcuteUserName(personIdentity.getPersonName());
// planAuditLog.setFlowTaskId(taskId);
// planAuditLog.setFlowTaskName(name);
// planAuditLog.setFlowJson(condition);
// planAuditLog.setRoleName(roleName);
// planAuditLogDao.save(planAuditLog);
// }
// }
// return b;
// }
// }
// return Boolean.FALSE;
// }
}
......@@ -4,5 +4,5 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
public interface IPlanAuditService {
Boolean auditWorkFlow(PlanAuditLog planAuditLog, String instanceId, String condition, ReginParams reginParams);
Boolean auditWorkFlow(PlanAuditLog planAuditLog, String condition, ReginParams reginParams);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment