需求驳回、拒绝时 状态

This commit is contained in:
wangliwen 2022-05-18 11:23:26 +08:00
parent ef50bd85b3
commit fec55086b6
1 changed files with 21 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.modules.activiti.service.ActTaskService;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.renren.modules.demanData.service.TDemandDataService;
@ -19,6 +20,7 @@ import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,6 +28,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
@ -45,6 +48,8 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
@Autowired
private TaskService taskService;
@Autowired
private ActTaskService actTaskService;
@Autowired
private SysUserService sysUserService;
@Autowired
private SysRoleUserService sysRoleUserService;
@ -168,14 +173,27 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为审批未通过---------------------------------");
} else {
demandDataDTO.setFlag(TDemandDataEntityFlag.APPROVE.getFlag());
} else if (demandDataDTO.getBackToFirst() != null && demandDataDTO.getBackToFirst()) { // 驳回
demandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag());
demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null);
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为已审批通过---------------------------------");
logger.error("---------------------------更新状态为已审批中---------------------------------");
} else if (demandDataDTO.getTermination() != null && demandDataDTO.getTermination()) { // 直接终止
demandDataDTO.setFlag(TDemandDataEntityFlag.REJECT.getFlag());
demandDataDTO.setApprovalUserDeptName(userDTO != null ? userDTO.getDeptName() : null);
demandDataDTO.setApprovalUserName(userDTO != null ? userDTO.getRealName() : null);
demandDataDTO.setApprovalOpinions(taskService.getTaskComments(delegateTask.getId()).stream().findFirst().get().getFullMessage());
logger.error("---------------------------更新状态为已拒绝---------------------------------");
}
logger.error("demandDataDTO:" + demandDataDTO);
Map<String, Object> combineResultMap = new HashMap<>();
ObjectMapper oMapper = new ObjectMapper();
Map<String, Object> variables = oMapper.convertValue(demandDataDTO, Map.class);
combineResultMap.putAll(delegateTask.getVariables());
combineResultMap.putAll(variables);
taskService.setVariables(delegateTask.getId(), combineResultMap);
tDemandDataService.update(demandDataDTO);
}
}