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

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

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