Răsfoiți Sursa

Merge branch 'feature/TeamWork.Task_Service_Add' into 'develop'

Merge of Feature/team work.task service add[工作管理]添加了一些关于工作任务操作的服务

See merge request o2oa/o2oa!182
李义 5 ani în urmă
părinte
comite
f8d67029f2
20 a modificat fișierele cu 404 adăugiri și 79 ștergeri
  1. 7 4
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/ThisApplication.java
  2. 0 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ReviewFactory.java
  3. 20 0
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListFactory.java
  4. 118 22
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java
  5. 10 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java
  6. 3 11
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java
  7. 40 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/TaskAction.java
  8. 3 0
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java
  9. 80 13
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java
  10. 44 11
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java
  11. 1 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java
  12. 0 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupPersistService.java
  13. 1 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupQueryService.java
  14. 1 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupService.java
  15. 29 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListQueryService.java
  16. 6 1
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java
  17. 30 2
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java
  18. 6 3
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskQueryService.java
  19. 4 4
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskService.java
  20. 1 0
      o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/timertask/Timertask_BatchOperationTask.java

+ 7 - 4
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/ThisApplication.java

@@ -19,14 +19,17 @@ public class ThisApplication {
 
 	public static void init() {
 		try {
-			//执行数据库中的批处理操作
-			MessageConnector.start(context());
+			//执行消息操作
 			queueBatchOperation = new QueueBatchOperation();
+
+			MessageConnector.start(context());
+
 			context().startQueue( queueBatchOperation );
+
 			new SystemConfigPersistService().initSystemConfig();
-			MessageConnector.start(context());
+
 			//每隔5分钟检查是否有未完成的批处理工作需要完成以及是否有未review的task需要核对权限信息
-			context.schedule( Timertask_BatchOperationTask.class, "0 */5 * * * ?" );
+			context.schedule( Timertask_BatchOperationTask.class, "0 */2 * * * ?" );
 			
 			//每天凌晨把所有项目的所有工作任务的权限和review信息核对一次
 			context.schedule( Timertask_RefreshAllTaskReview.class, "0 0 2 * * ?" );

+ 0 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/ReviewFactory.java

@@ -201,7 +201,6 @@ public class ReviewFactory extends AbstractFactory {
 		Root<Review> root = cq.from( Review.class );
 		Predicate p = cb.equal( root.get( Review_.permissionObj ), person );
 		p = cb.and( p, cb.equal( root.get( Review_.parent ), taskId ));
-		System.out.println(">>>SQL:" + em.createQuery( cq.where(p) ) );
 		return em.createQuery( cq.where(p) ).getResultList();
 	}
 }

+ 20 - 0
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/factory/TaskListFactory.java

@@ -341,6 +341,9 @@ public class TaskListFactory extends AbstractFactory {
 		if( StringUtils.isEmpty( taskId ) ){
 			return null;
 		}
+		if( StringUtils.isEmpty( taskGroupId ) ){
+			return null;
+		}
 		EntityManager em = this.entityManagerContainer().get(TaskListRele.class);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<TaskListRele> cq = cb.createQuery(TaskListRele.class);
@@ -350,6 +353,23 @@ public class TaskListFactory extends AbstractFactory {
 		return em.createQuery(cq.where(p)).getResultList();
 	}
 
+	public List<String> listTaskListIdWithTask(String taskId, String taskGroupId ) throws Exception {
+		if( StringUtils.isEmpty( taskId ) ){
+			return null;
+		}
+		if( StringUtils.isEmpty( taskGroupId ) ){
+			return null;
+		}
+		EntityManager em = this.entityManagerContainer().get(TaskListRele.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<String> cq = cb.createQuery(String.class);
+		Root<TaskListRele> root = cq.from(TaskListRele.class);
+		Predicate p = cb.equal( root.get(TaskListRele_.taskId ), taskId );
+		p = cb.and( p, cb.equal( root.get(TaskListRele_.taskGroupId ), taskGroupId ) );
+		cq.select( root.get(TaskListRele_.taskListId) );
+		return em.createQuery(cq.where(p)).getResultList();
+	}
+
 	public List<String> listTaskListIdsWithGroup(String taskGroupId, String person) throws Exception {
 		if( StringUtils.isEmpty( taskGroupId ) ){
 			return null;

+ 118 - 22
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionGet.java

@@ -5,6 +5,7 @@ import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.x.teamwork.core.entity.*;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
@@ -17,11 +18,6 @@ import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.ListTools;
-import com.x.teamwork.core.entity.ProjectExtFieldRele;
-import com.x.teamwork.core.entity.Task;
-import com.x.teamwork.core.entity.TaskDetail;
-import com.x.teamwork.core.entity.TaskExtField;
-import com.x.teamwork.core.entity.TaskTag;
 
 import net.sf.ehcache.Element;
 
@@ -108,11 +104,11 @@ public class ActionGet extends BaseAction {
 						wo.setDetail( taskDetail.getDetail() );
 						wo.setDescription( taskDetail.getDescription() );
 					}
-					
-//					if( taskExtField != null ) {
-//						wo.setExtField( WoTaskExtField.copier.copy( taskExtField ));
-//					}
-					
+
+					if( taskExtField != null ) {
+						wo.setExtField( WoTaskExtField.copier.copy( taskExtField ));
+					}
+
 					if( ListTools.isNotEmpty( extFieldReleList )) {
 						List<WoExtFieldRele> reles = WoExtFieldRele.copier.copy( extFieldReleList ) ;
 						for( WoExtFieldRele woExtFieldRele :  reles ) {
@@ -125,15 +121,93 @@ public class ActionGet extends BaseAction {
 					if( ListTools.isNotEmpty( tags )) {
 						wo.setTags( WoTaskTag.copier.copy( tags ));
 					}
-					taskCache.put(new Element( cacheKey, wo ));
-					result.setData(wo);
+
 				} catch (Exception e) {
 					Exception exception = new TaskQueryException(e, "将查询出来的工作任务信息对象转换为可输出的数据信息时发生异常。");
 					result.error(exception);
 					logger.error(e, effectivePerson, request, null);
 				}
 			}
+
+			//查询任务所在的Group信息
+			if (check) {
+				List<String> groupIds = null;
+				try {
+					groupIds = taskGroupQueryService.listGroupIdsByTask( task.getId() );
+					if( ListTools.isNotEmpty( groupIds )){
+						wo.setTaskGroupId( groupIds.get(0) );
+					}
+				} catch (Exception e) {
+					check = false;
+					Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject());
+					result.error(exception);
+					logger.error(e, effectivePerson, request, null);
+				}
+			}
+
+			//查询任务所在的List信息
+			if (check) {
+				if( StringUtils.isNotEmpty(wo.getTaskGroupId() )){
+					List<String> listIds = null;
+					try {
+						listIds = taskListQueryService.listTaskListIdWithTaskId( task.getId(), wo.getTaskGroupId() );
+						if( ListTools.isNotEmpty( listIds )){
+							wo.setTaskListId( listIds.get(0) );
+						}
+					} catch (Exception e) {
+						Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject());
+						result.error(exception);
+						logger.error(e, effectivePerson, request, null);
+					}
+				}
+			}
+
+//			//查询任务所在的Group信息
+//			if (check) {
+//				List<String> groupIds = null;
+//				List<TaskGroup> groupList = null;
+//				List<WoTaskGroup> woGroupList = new ArrayList<>();
+//				try {
+//					groupIds = taskGroupQueryService.listGroupIdsByTask( task.getId() );
+//					groupList = taskGroupQueryService.list( groupIds );
+//					if( ListTools.isNotEmpty( groupList )){
+//						woGroupList = WoTaskGroup.copier.copy( groupList );
+//					}
+//					wo.setTaskgroups( woGroupList );
+//				} catch (Exception e) {
+//					check = false;
+//					Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject());
+//					result.error(exception);
+//					logger.error(e, effectivePerson, request, null);
+//				}
+//			}
+//
+//			//查询任务所在的List信息
+//			if (check) {
+//				if( ListTools.isNotEmpty(wo.getTaskgroups() )){
+//					List<String> listIds = null;
+//					List<TaskList> taskLists = null;
+//					List<WoTaskList> woTaskLists = new ArrayList<>();
+//					for( WoTaskGroup woGroup : wo.getTaskgroups() ){
+//						try {
+//							listIds = taskListQueryService.listTaskListIdWithTaskId( task.getId(), woGroup.getId() );
+//							taskLists = taskListQueryService.list( listIds );
+//							if( ListTools.isNotEmpty( taskLists )){
+//								woTaskLists = WoTaskList.copier.copy( taskLists );
+//							}
+//							woGroup.setTaskLists( woTaskLists );
+//						} catch (Exception e) {
+//							check = false;
+//							Exception exception = new TaskQueryException(e, "根据指定projectId查询项目扩展列配置信息对象时发生异常。projectId:" + task.getProject());
+//							result.error(exception);
+//							logger.error(e, effectivePerson, request, null);
+//						}
+//					}
+//				}
+//			}
 		}
+		taskCache.put(new Element( cacheKey, wo ));
+		result.setData(wo);
 		return result;
 	}
 
@@ -145,24 +219,46 @@ public class ActionGet extends BaseAction {
 		@FieldDescribe("说明详细信息(10M)")
 		private String description;
 		
-//		@FieldDescribe("扩展属性信息(对象)")
-//		private WoTaskExtField extField;
+		@FieldDescribe("扩展属性信息(对象)")
+		private WoTaskExtField extField;
 		
 		@FieldDescribe("任务标签(列表)")
 		private List<WoTaskTag> tags = null;
 		
 		@FieldDescribe("所属项目的扩展列设定(配置列表)")
 		private List<WoExtFieldRele> extFieldConfigs;
-		
+
+		@FieldDescribe("工作任务所属的工作任务组信息ID")
+		String taskGroupId = null;
+
+		@FieldDescribe("工作任务所属的工作任务列表(泳道)信息ID")
+		String taskListId = null;
+
 		private Long rank;
 
-//		public WoTaskExtField getExtField() {
-//			return extField;
-//		}
-//
-//		public void setExtField(WoTaskExtField extField) {
-//			this.extField = extField;
-//		}
+		public String getTaskGroupId() {
+			return taskGroupId;
+		}
+
+		public void setTaskGroupId(String taskGroupId) {
+			this.taskGroupId = taskGroupId;
+		}
+
+		public String getTaskListId() {
+			return taskListId;
+		}
+
+		public void setTaskListId(String taskListId) {
+			this.taskListId = taskListId;
+		}
+
+		public WoTaskExtField getExtField() {
+			return extField;
+		}
+
+		public void setExtField(WoTaskExtField extField) {
+			this.extField = extField;
+		}
 
 		public List<WoExtFieldRele> getExtFieldConfigs() {
 			return extFieldConfigs;

+ 10 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/ActionSave.java

@@ -226,6 +226,15 @@ public class ActionSave extends BaseAction {
 			}
 		}
 
+		//查询该任务和任务组的绑定情况
+		if (check) {
+			if( !taskGroupQueryService.existsWithTaskAndGroup( wi.getTaskGroupId(), task.getId() )){
+				//添加任务和任务组的关联
+				taskGroupPersistService.addTaskToGroup( task.getId(), wi.getTaskGroupId() );
+				taskGroupPersistService.refreshTaskCountInTaskGroupWithTaskId( effectivePerson.getDistinguishedName(), task.getId() );
+			}
+		}
+
 		//检查标签是否有变动
 		if (check) {
 			//检查任务和标签的所有关联
@@ -713,7 +722,7 @@ public class ActionSave extends BaseAction {
 
 	}
 
-public static class Wo extends WoId {
+	public static class Wo extends WoId {
 		
 		@FieldDescribe("操作引起的动态内容")
 		List<WoDynamic> dynamics = new ArrayList<>();

+ 3 - 11
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/BaseAction.java

@@ -3,17 +3,7 @@ package com.x.teamwork.assemble.control.jaxrs.task;
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.cache.ApplicationCache;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
-import com.x.teamwork.assemble.control.service.DynamicPersistService;
-import com.x.teamwork.assemble.control.service.ProjectExtFieldReleQueryService;
-import com.x.teamwork.assemble.control.service.ProjectQueryService;
-import com.x.teamwork.assemble.control.service.TaskGroupPersistService;
-import com.x.teamwork.assemble.control.service.TaskGroupQueryService;
-import com.x.teamwork.assemble.control.service.TaskListPersistService;
-import com.x.teamwork.assemble.control.service.TaskPersistService;
-import com.x.teamwork.assemble.control.service.TaskQueryService;
-import com.x.teamwork.assemble.control.service.TaskTagPersistService;
-import com.x.teamwork.assemble.control.service.TaskTagQueryService;
-import com.x.teamwork.assemble.control.service.TaskViewQueryService;
+import com.x.teamwork.assemble.control.service.*;
 import com.x.teamwork.core.entity.Task;
 import com.x.teamwork.core.entity.TaskView;
 
@@ -38,6 +28,8 @@ public class BaseAction extends StandardJaxrsAction {
 	protected 	TaskPersistService taskPersistService = new TaskPersistService();
 	
 	protected TaskListPersistService taskListPersistService = new TaskListPersistService();
+
+	protected TaskListQueryService taskListQueryService = new TaskListQueryService();
 	
 	protected TaskGroupQueryService taskGroupQueryService = new TaskGroupQueryService();
 	

+ 40 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/task/TaskAction.java

@@ -90,7 +90,46 @@ public class TaskAction extends StandardJaxrsAction {
 		}
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
-	
+
+	@JaxrsMethodDescribe(value = "将指定的工作转换为子工作.", action = ActionTransformAsSubTask.class)
+	@GET
+	@Path("transform/{tid}/parent/{pid}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void transformAsSubTask(@Suspended final AsyncResponse asyncResponse,
+								  @Context HttpServletRequest request,
+								  @JaxrsParameterDescribe("指定任务ID") @PathParam("tid") String tid,
+								  @JaxrsParameterDescribe("上级任务ID") @PathParam("pid") String pid) {
+		ActionResult<ActionTransformAsSubTask.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionTransformAsSubTask().execute( request, effectivePerson, tid, pid );
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "复制指定的工作为新的工作.", action = ActionCopyTask.class)
+	@GET
+	@Path("copy/{tid}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void copyTask(@Suspended final AsyncResponse asyncResponse,
+								   @Context HttpServletRequest request,
+								   @JaxrsParameterDescribe("指定任务ID") @PathParam("tid") String tid) {
+		ActionResult<ActionCopyTask.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionCopyTask().execute( request, effectivePerson, tid );
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
 	@JaxrsMethodDescribe(value = "查询我的项目首页中工作任务视图信息.", action = ActionStatisticMyTaskViews.class)
 	@GET
 	@Path("statitic/group/{projectId}")

+ 3 - 0
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/BatchOperationProcessService.java

@@ -99,6 +99,9 @@ public class BatchOperationProcessService {
 				if( StringUtils.isEmpty( task.getParent() )) {
 					task.setParent( "0" );
 				}
+				if( StringUtils.equals( task.getId(), task.getParent() )) {
+					task.setParent( "0" );
+				}
 				emc.check( task, CheckPersistType.all );
 				emc.commit();
 			}

+ 80 - 13
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicPersistService.java

@@ -82,7 +82,6 @@ public class DynamicPersistService {
 	
 	/**
 	 * 保存项目创建或者更新动态信息
-	 * @param old_object
 	 * @param object
 	 * @param effectivePerson
 	 * @param content
@@ -132,9 +131,7 @@ public class DynamicPersistService {
 	 * 保存项目扩展信息保存操作动态信息
 	 * @param object_old
 	 * @param object
-	 * @param optType
 	 * @param effectivePerson
-	 * @param content
 	 * @return
 	 * @throws Exception
 	 */
@@ -179,8 +176,8 @@ public class DynamicPersistService {
 	
 	/**
 	 * 保存动态信息
+	 * @param object_old
 	 * @param object
-	 * @param optType
 	 * @param effectivePerson
 	 * @param content
 	 * @return
@@ -230,7 +227,6 @@ public class DynamicPersistService {
 	 * @param object_old
 	 * @param object_new
 	 * @param effectivePerson
-	 * @param content
 	 * @return
 	 * @throws Exception
 	 */
@@ -257,11 +253,87 @@ public class DynamicPersistService {
 		}
 		return result;
 	}
-	
+
 	/**
-	 * 保存动态信息
-	 * @param dynamic
+	 * 工作复制动态信息
+	 * @param sourceTask
+	 * @param newTask
+	 * @param effectivePerson
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Dynamic> taskCopyDynamic( Task sourceTask, Task newTask, EffectivePerson effectivePerson ) throws Exception {
+		if ( sourceTask == null) {
+			throw new Exception("sourceTask is null.");
+		}
+		if ( newTask == null) {
+			throw new Exception("newTask is null.");
+		}
+		if ( effectivePerson == null ) {
+			throw new Exception("effectivePerson is null.");
+		}
+		List<Dynamic> result = new ArrayList<>();
+		List<Dynamic> dynamics = null;
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			dynamics = dynamicService.getTaskCopyDynamic( sourceTask, newTask, effectivePerson );
+			if( ListTools.isNotEmpty( dynamics )) {
+				for( Dynamic dynamic : dynamics ) {
+					dynamic = dynamicService.save( emc, dynamic, "" );
+					result.add( dynamic );
+				}
+			}
+		} catch (Exception e) {
+			throw e;
+		}
+		return result;
+	}
+
+	/**
+	 * 保存转换子工作的动态信息
+	 * @param subTask
+	 * @param parentTask
+	 * @param effectivePerson
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Dynamic> subTaskTransformDynamic( Task subTask, Task parentTask, EffectivePerson effectivePerson ) throws Exception {
+		if ( subTask == null) {
+			throw new Exception("sourceTask is null.");
+		}
+		if ( parentTask == null) {
+			throw new Exception("parentTask is null.");
+		}
+		if ( effectivePerson == null ) {
+			throw new Exception("effectivePerson is null.");
+		}
+		List<Dynamic> result = new ArrayList<>();
+		List<Dynamic> dynamics = null;
+
+		//记录一个添加子任务转换的动态信息
+		result.add(dynamicService.getTaskTransformDynamic( parentTask, subTask, effectivePerson));
+
+		//记录一个为上级任务添加子任务的动态信息
+		result.add(dynamicService.getTaskSplitDynamic( parentTask, subTask, effectivePerson));
+
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			if( ListTools.isNotEmpty( result )) {
+				for( Dynamic dynamic : result ) {
+					//持久化工作操作动态
+					dynamicService.save( emc, dynamic, "" );
+				}
+			}
+		} catch (Exception e) {
+			throw e;
+		}
+		return result;
+	}
+
+	/**
+	 * 保存项目工作组信息动态
+	 * @param object_old
+	 * @param object
 	 * @param effectivePerson
+	 * @param content
 	 * @return
 	 * @throws Exception
 	 */
@@ -287,7 +359,6 @@ public class DynamicPersistService {
 	 * 保存项目组删除动态信息
 	 * @param object
 	 * @param effectivePerson
-	 * @param content
 	 * @return
 	 * @throws Exception
 	 */
@@ -311,7 +382,6 @@ public class DynamicPersistService {
 	 * 保存工作任务删除动态信息
 	 * @param object
 	 * @param effectivePerson
-	 * @param content
 	 * @return
 	 * @throws Exception
 	 */
@@ -338,7 +408,6 @@ public class DynamicPersistService {
 	 * @param addManagers
 	 * @param removeManagers
 	 * @param effectivePerson
-	 * @param content
 	 * @throws Exception
 	 */
 	public List<Dynamic> taskManagerUpdateDynamic(Task task, List<String> addManagers, List<String> removeManagers, EffectivePerson effectivePerson ) throws Exception {
@@ -421,7 +490,6 @@ public class DynamicPersistService {
 	 * @param addParticipants
 	 * @param removeParticipants
 	 * @param effectivePerson
-	 * @param content
 	 * @throws Exception
 	 */
 	public List<Dynamic> taskParticipantsUpdateDynamic(Task task, List<String> addParticipants, List<String> removeParticipants, EffectivePerson effectivePerson ) throws Exception {
@@ -570,7 +638,6 @@ public class DynamicPersistService {
 	 * 保存工作任务评论删除动态信息
 	 * @param object
 	 * @param effectivePerson
-	 * @param content
 	 * @return
 	 * @throws Exception
 	 */

+ 44 - 11
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/DynamicService.java

@@ -103,8 +103,6 @@ class DynamicService {
 	 * @param maxCount
 	 * @param orderField
 	 * @param orderType
-	 * @param projectIds
-	 * @param taskIds
 	 * @return
 	 * @throws Exception
 	 */
@@ -116,7 +114,7 @@ class DynamicService {
 	/**
 	 * 向数据库持久化动态信息
 	 * @param emc
-	 * @param dynamic
+	 * @param object
 	 * @return
 	 * @throws Exception 
 	 */
@@ -480,7 +478,6 @@ class DynamicService {
 	 * 保存和根据项目组信息操作动态
 	 * @param object_old
 	 * @param object
-	 * @param optType
 	 * @param effectivePerson
 	 * @return
 	 */
@@ -731,10 +728,35 @@ class DynamicService {
 		
 		return dynamics;
 	}
-	
+
+	/**
+	 * 复制任务信息操作动态
+	 * @param sourceTask
+	 * @param newTask
+	 * @param effectivePerson
+	 * @return
+	 * @throws Exception
+	 */
+	protected List<Dynamic> getTaskCopyDynamic( Task sourceTask, Task newTask, EffectivePerson effectivePerson ) throws Exception {
+		String objectType =  "TASK";
+		String optType =  "TASK_INFO";
+		String title =  "复制工作任务信息";
+		List<Dynamic> dynamics = new ArrayList<>();
+		String viewUrl = null;
+		String description = null;
+
+		if( sourceTask != null ) {
+			optType =  "COPY";
+			title =  "工作任务信息复制";
+			description = effectivePerson.getName() + "复制了任务:" + sourceTask.getName() + "。";
+			dynamics.add( composeNewDynamic( objectType, title, description, viewUrl, optType, newTask, effectivePerson, false ) );
+		}
+		return dynamics;
+	}
+
 	/**
 	 * 更新工作任务管理者信息操作动态
-	 * @param task
+	 * @param object
 	 * @param addManagers
 	 * @param removeManagers
 	 * @param effectivePerson
@@ -768,7 +790,7 @@ class DynamicService {
 	
 	/**
 	 * 更新工作任务参与者操作动态
-	 * @param task
+	 * @param object
 	 * @param addParticipants
 	 * @param removeParticipants
 	 * @param effectivePerson
@@ -805,11 +827,22 @@ class DynamicService {
 		String title =  "工作任务分解";
 		String viewUrl = task.getId();
 		String optType =  "SPLIT";
-		String description = effectivePerson.getName() +"为工作添加了一个子任务:" + task.getName();
+		String description = effectivePerson.getName() +"为工作添加了一个子任务:[" + task.getName() + "]";
 		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, parentTask, effectivePerson, false );
 		dynamic.setTarget( parentTask.getExecutor() );		
 		return dynamic;
 	}
+
+	public Dynamic getTaskTransformDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) {
+		String objectType =  "TASK";
+		String title =  "转换为子工作";
+		String viewUrl = task.getId();
+		String optType =  "TRANSFORM";
+		String description = effectivePerson.getName() +"将工作转换为工作[" +parentTask.getName() + "]的一个子任务。";
+		Dynamic dynamic =  composeNewDynamic( objectType, title, description, viewUrl, optType, task, effectivePerson, false );
+		dynamic.setTarget( task.getExecutor() );
+		return dynamic;
+	}
 	
 	public Dynamic subTaskDeleteDynamic(Task parentTask, Task task, EffectivePerson effectivePerson) {
 		String objectType =  "TASK";
@@ -888,7 +921,7 @@ class DynamicService {
 	
 	/**
 	 * 工作任务附件上传操作动态信息
-	 * @param attachment
+	 * @param object
 	 * @param effectivePerson
 	 * @return
 	 */
@@ -903,7 +936,7 @@ class DynamicService {
 	
 	/**
 	 * 工作任务附件下载操作动态信息
-	 * @param attachment
+	 * @param object
 	 * @param effectivePerson
 	 * @return
 	 */
@@ -918,7 +951,7 @@ class DynamicService {
 
 	/**
 	 * 工作任务附件删除操作动态信息
-	 * @param attachment
+	 * @param object
 	 * @param effectivePerson
 	 * @return
 	 */

+ 1 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/ReviewService.java

@@ -263,7 +263,7 @@ public class ReviewService {
 			}
 			
 			//查查该工作是否有上级工作,如果有上级工作,那上级工作的可见人员也应该加入到该工作的可见人员中
-			if( StringUtils.isNotEmpty( task.getParent() )) {
+			if( StringUtils.isNotEmpty( task.getParent() ) && !StringUtils.equals( task.getParent(), task.getId() ) ) {
 				permissionObjs = addTaskAllPermission( emc, permissionObjs, task.getParent() );
 			}
 		}

+ 0 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupPersistService.java

@@ -77,7 +77,6 @@ public class TaskGroupPersistService {
 	
 	/**
 	 *  将工作任务从工作任务组中除去
-	 * @param emc
 	 * @param taskId
 	 * @param groupId
 	 * @throws Exception

+ 1 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupQueryService.java

@@ -142,7 +142,7 @@ public class TaskGroupQueryService {
 	/**
 	 * 判断是否存在分组和工作任务的关联
 	 * @param taskId
-	 * @param projectId
+	 * @param groupId
 	 * @return
 	 * @throws Exception 
 	 */

+ 1 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskGroupService.java

@@ -109,7 +109,7 @@ class TaskGroupService {
 		if( taskGroup != null ){
 			reles = business.taskGroupReleFactory().listWithGroupAndTask( groupId, taskId );
 			if( ListTools.isEmpty( reles )) { 
-				emc.beginTransaction( TaskGroup.class );		
+				emc.beginTransaction( TaskGroupRele.class );
 				taskGroupRele = new TaskGroupRele();
 				taskGroupRele.setId( TaskGroupRele.createId() );
 				taskGroupRele.setProject( taskGroup.getProject() );

+ 29 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListQueryService.java

@@ -37,7 +37,32 @@ public class TaskListQueryService {
 			throw e;
 		}
 	}
-	
+
+	public List<TaskList> list(List<String> listIds) throws Exception {
+		if ( ListTools.isEmpty( listIds )) {
+			return null;
+		}
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			return emc.list( TaskList.class, listIds);
+		} catch (Exception e) {
+			throw e;
+		}
+	}
+
+	public List<String> listTaskListIdWithTaskId( String taskId, String taskGroupId) throws Exception {
+		if ( StringUtils.isEmpty( taskId )) {
+			throw new Exception("taskId is empty.");
+		}
+		if ( StringUtils.isEmpty( taskGroupId )) {
+			throw new Exception("taskGroupId is empty.");
+		}
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			return taskListService.listTaskListIdWithTask( emc, taskId, taskGroupId );
+		} catch (Exception e) {
+			throw e;
+		}
+	}
+
 	/**
 	 *  根据用户和项目ID查询工作任务列表
 	 * @param person
@@ -151,4 +176,7 @@ public class TaskListQueryService {
 		taskList.setOwner( person );
 		return taskList;
 	}
+
+
+
 }

+ 6 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskListService.java

@@ -66,6 +66,11 @@ class TaskListService {
 		Business business = new Business( emc );	
 		return business.taskListFactory().listTaskListWithTask( taskId, taskGroupId );
 	}
+
+	public List<String> listTaskListIdWithTask(EntityManagerContainer emc, String taskId, String taskGroupId ) throws Exception {
+		Business business = new Business( emc );
+		return business.taskListFactory().listTaskListIdWithTask( taskId, taskGroupId );
+	}
 	
 	public List<String> listTaskListIdsWithGroup(EntityManagerContainer emc, String taskGroupId, String person) throws Exception {
 		Business business = new Business( emc );	
@@ -117,7 +122,7 @@ class TaskListService {
 	/**
 	 * 向数据库持久化工作任务列表列表信息
 	 * @param emc
-	 * @param taskList
+	 * @param object
 	 * @return
 	 * @throws Exception 
 	 */

+ 30 - 2
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskPersistService.java

@@ -79,6 +79,7 @@ public class TaskPersistService {
 		if ( task == null) {
 			throw new Exception( "task is null." );
 		}
+
 		if( StringUtils.isEmpty( task.getName() )) {
 			task.setName("无标题工作任务("+ DateOperation.getNowDateTime() +")");
 		}		
@@ -190,7 +191,34 @@ public class TaskPersistService {
 			throw e;
 		}
 	}
-	
+
+
+	/**
+	 * 更新任务的上级任务ID信息
+	 * @param taskId
+	 * @param parentId
+	 * @param effectivePerson
+	 * @throws Exception
+	 */
+	public void updateParentId( String taskId, String parentId, EffectivePerson effectivePerson) throws Exception {
+
+		if( StringUtils.isEmpty( taskId )) {
+			throw new Exception("taskId can not empty in update parentId.");
+		}
+		try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Task task = emc.find( taskId, Task.class );
+			if( task != null ){
+				task.setParent( parentId );
+			}
+			emc.beginTransaction( Task.class );
+			emc.check( task, CheckPersistType.all );
+			emc.commit();
+		} catch (Exception e) {
+			throw e;
+		}
+
+	}
+
 	/**
 	 * 查询用户是否拥有创建工作任务的权限
 	 * @param effectivePerson
@@ -588,5 +616,5 @@ public class TaskPersistService {
 		}
 	}
 
-	
+
 }

+ 6 - 3
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskQueryService.java

@@ -217,7 +217,9 @@ public class TaskQueryService {
 					for( TaskListRele rele : taskListReles ) {
 						task = emc.find( rele.getTaskId(), Task.class );
 						//只查询自己负责的任务
-						if( personName.equalsIgnoreCase( task.getExecutor() )) {
+						if( personName.equalsIgnoreCase( task.getExecutor() ) ||
+								( task.getParticipantList() !=null && task.getParticipantList().contains( personName ))
+						) {
 							task.setOrder( rele.getOrder() );
 							resultList.add( task );
 						}
@@ -252,7 +254,9 @@ public class TaskQueryService {
 				if( ListTools.isNotEmpty( taskListTmp )) {
 					for( Task _task : taskListTmp ) {
 						//只查询自己负责的任务
-						if( personName.equalsIgnoreCase( _task.getExecutor() )) {
+						if( personName.equalsIgnoreCase( _task.getExecutor() )||
+								( _task.getParticipantList() !=null && _task.getParticipantList().contains( personName )))
+						{
 							resultList.add( _task );
 						}
 					}
@@ -266,7 +270,6 @@ public class TaskQueryService {
 	
 	/**
 	 * 在人员的可见范围之类,根据指定的工作任务ID,查询子任务列表
-	 * @param project
 	 * @param taskId
 	 * @param effectivePerson
 	 * @return

+ 4 - 4
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/service/TaskService.java

@@ -138,11 +138,11 @@ class TaskService {
 	/**
 	 * 向数据库持久化工作任务信息
 	 * @param emc
-	 * @param taskExtField 
-	 * @param taskDetail 
-	 * @param task
+	 * @param object
+	 * @param detail
+	 * @param extField
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	protected Task save( EntityManagerContainer emc, Task object, TaskDetail detail, TaskExtField extField ) throws Exception {
 		Task task = null;

+ 1 - 0
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/timertask/Timertask_BatchOperationTask.java

@@ -42,6 +42,7 @@ public class Timertask_BatchOperationTask extends AbstractJob {
 					try {
 						logger.info("Timertask_BatchOperationTask -> send operation to queue[queueBatchOperation]......");
 						ThisApplication.queueBatchOperation.send( operation );
+						Thread.sleep(500 );
 					} catch (Exception e) {
 						logger.warn("Timertask_BatchOperationTask -> send operation to queue got an exception.");
 						logger.error(e);