Merge branch 'master' into docker_package
This commit is contained in:
commit
390828b619
|
@ -290,11 +290,17 @@ public class ActTaskController {
|
|||
@LogOperation("终止流程(直接全拒绝)")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "instanceId", value = "实例ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType = "String")
|
||||
})
|
||||
// @RequiresPermissions("sys:task:all")
|
||||
public Result endProcess(String taskId, String comment) {
|
||||
actTaskService.endProcess(taskId, comment);
|
||||
public Result endProcess(String taskId, String instanceId, String comment) {
|
||||
if (!StringUtils.isEmpty(taskId)) { // 存在taskId
|
||||
actTaskService.endProcess(taskId, comment);
|
||||
}
|
||||
if (StringUtils.isEmpty(taskId) && !StringUtils.isEmpty(instanceId)) { // 通过实例id
|
||||
actTaskService.endProcessInstanceId(taskId, comment);
|
||||
}
|
||||
return new Result();
|
||||
}
|
||||
|
||||
|
|
|
@ -624,6 +624,58 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void endProcessInstanceId(String instanceId, String comment) {
|
||||
if (isMultiInstance(instanceId)) {
|
||||
throw new RenException(ErrorCode.END_PROCESS_PARALLEL_ERROR);
|
||||
}
|
||||
Task task = taskService.createTaskQuery().processInstanceId(instanceId).singleResult();
|
||||
List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId())
|
||||
.taskDefinitionKey(task.getTaskDefinitionKey()).list();
|
||||
if (tasks.size() > 1) {
|
||||
throw new RenException(ErrorCode.END_PROCESS_HANDLEING_ERROR);
|
||||
}
|
||||
ActivityImpl endActivity = findActivitiImplByInstanceId(instanceId, "end");
|
||||
if (endActivity == null) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(endActivity.getId())) {
|
||||
if (!StringUtils.isEmpty(task.getOwner())) {
|
||||
taskService.resolveTask(task.getId());
|
||||
}
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
|
||||
taskService.complete(instanceId);
|
||||
} else {
|
||||
ActivityImpl currActivity = findActivitiImplByInstanceId(instanceId, null);
|
||||
List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
|
||||
List<PvmTransition> pvmTransitionList = currActivity
|
||||
.getOutgoingTransitions();
|
||||
for (PvmTransition pvmTransition : pvmTransitionList) {
|
||||
oriPvmTransitionList.add(pvmTransition);
|
||||
}
|
||||
pvmTransitionList.clear();
|
||||
TransitionImpl newTransition = currActivity.createOutgoingTransition();
|
||||
ActivityImpl pointActivity = findActivitiImplByInstanceId(instanceId, endActivity.getId());
|
||||
newTransition.setDestination(pointActivity);
|
||||
if (StringUtils.isNotEmpty(task.getOwner())) {
|
||||
taskService.resolveTask(task.getId());
|
||||
}
|
||||
String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE);
|
||||
comment = message + "[" + comment + "]";
|
||||
taskService.addComment(task.getId(), task.getProcessInstanceId(), comment);
|
||||
taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP);
|
||||
taskService.setVariable(task.getId(), "reject", Boolean.TRUE); // 存在被拒绝的批示
|
||||
taskService.complete(instanceId);
|
||||
pointActivity.getIncomingTransitions().remove(newTransition);
|
||||
List<PvmTransition> pvmTransitionListC = currActivity.getOutgoingTransitions();
|
||||
pvmTransitionListC.clear();
|
||||
for (PvmTransition pvmTransition : oriPvmTransitionList) {
|
||||
pvmTransitionListC.add(pvmTransition);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ActivityImpl findActivitiImpl(String taskId, String activityId) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
if (task == null) {
|
||||
|
@ -648,6 +700,30 @@ public class ActTaskService extends BaseServiceImpl {
|
|||
return activityImpl;
|
||||
}
|
||||
|
||||
private ActivityImpl findActivitiImplByInstanceId(String instanceId, String activityId) {
|
||||
Task task = taskService.createTaskQuery().processInstanceId(instanceId).singleResult();
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
|
||||
if (processDefinition == null) {
|
||||
throw new RenException(ErrorCode.NONE_EXIST_PROCESS);
|
||||
}
|
||||
if (StringUtils.isEmpty(activityId)) {
|
||||
activityId = task.getTaskDefinitionKey();
|
||||
}
|
||||
if ("END".equals(activityId.toUpperCase())) {
|
||||
for (ActivityImpl activityImpl : processDefinition.getActivities()) {
|
||||
String type = (String) activityImpl.getProperty("type");
|
||||
if ("endEvent".equals(type)) {
|
||||
return activityImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivityImpl activityImpl = processDefinition.findActivity(activityId);
|
||||
return activityImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换Task对象
|
||||
*
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TDemandDataController {
|
|||
@GetMapping("/selectFlagCountByDepts")
|
||||
@ApiOperation("按照业务标志统计本部门能力需求")
|
||||
@LogOperation("按照业务标志统计本部门能力需求")
|
||||
public Result selectFlagCountByDepts(){
|
||||
public Result selectFlagCountByDepts() {
|
||||
return new Result().ok(tDemandDataService.selectFlagCountByDepts());
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,9 @@ public class TDemandDataController {
|
|||
// @RequiresPermissions("demanData:tdemanddata:info")
|
||||
public Result<TDemandDataDTO> get(@PathVariable("id") Long id) {
|
||||
TDemandDataDTO data = tDemandDataService.get(id);
|
||||
data.setCommentCount(tDemandCommentService.commentCount(id));
|
||||
if (data != null) {
|
||||
data.setCommentCount(tDemandCommentService.commentCount(id));
|
||||
}
|
||||
return new Result<TDemandDataDTO>().ok(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,11 @@ public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
|
|||
|
||||
void batchSaveOrgenization(List<Map> list);
|
||||
|
||||
@Select("SELECT name,parent_id,id,path FROM t_camera_organization_cache WHERE id = #{id}")
|
||||
@Select("SELECT name,parent_id,id,path FROM t_camera_organization WHERE id = #{id}")
|
||||
Map selectOrgenizationById(@Param("id") String id);
|
||||
|
||||
Map selectOrgenizationCacheById(@Param("id") String id);
|
||||
|
||||
@Update("UPDATE t_camera_organization SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}")
|
||||
void updateOrganizationPaht(@Param("path") String path,@Param("id") String id);
|
||||
|
||||
|
|
|
@ -1251,7 +1251,7 @@ public class MonitorService {
|
|||
|
||||
//更新组织的path
|
||||
public void setOrganizationPath(Map map ,String parentId){
|
||||
Map map2 = cameraOrgenMapper.selectOrgenizationById(parentId);
|
||||
Map map2 = cameraOrgenMapper.selectOrgenizationCacheById(parentId);
|
||||
if(map2 != null){
|
||||
String path = map2.get("name").toString();
|
||||
String newNodeName = path + "->" + (map.get("path")==null?"":map.get("path").toString());
|
||||
|
|
|
@ -65,4 +65,8 @@
|
|||
)
|
||||
SELECT id,name,parent_id,sort,subCount,is_parent,path,is_root,channelCount,count FROM t_camera_organization_cache
|
||||
</insert>
|
||||
|
||||
<select id="selectOrgenizationCacheById" parameterType="java.lang.String" resultType="java.util.Map">
|
||||
SELECT name,parent_id,id,path FROM t_camera_organization_cache WHERE id = #{id}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue