Browse Source

teamwork后台服务

luojing 5 years ago
parent
commit
0b7599d89b

+ 7 - 10
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/ActionProjectConfigGetByProject.java

@@ -24,10 +24,11 @@ public class ActionProjectConfigGetByProject extends BaseAction {
 
 
 	private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigGetByProject.class);
 	private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigGetByProject.class);
 
 
-	protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
-		ActionResult<List<Wo>> result = new ActionResult<List<Wo>>();
-		List<Wo>  wo = null;
+	protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
+		ActionResult<Wo> result = new ActionResult<Wo>();
+		Wo  wo = null;
 		List<ProjectConfig>  projectConfigs = null;
 		List<ProjectConfig>  projectConfigs = null;
+		ProjectConfig projectConfig = null;
 		Boolean check = true;
 		Boolean check = true;
 
 
 		if ( StringUtils.isEmpty( id ) ) {
 		if ( StringUtils.isEmpty( id ) ) {
@@ -39,9 +40,10 @@ public class ActionProjectConfigGetByProject extends BaseAction {
 		if( Boolean.TRUE.equals( check ) ){
 		if( Boolean.TRUE.equals( check ) ){
 			try {
 			try {
 				projectConfigs = projectConfigQueryService.getProjectConfigByProject( id );
 				projectConfigs = projectConfigQueryService.getProjectConfigByProject( id );
-				/*if(ListTools.isNotEmpty(projectConfigs)){
+				if(ListTools.isNotEmpty(projectConfigs)){
 					projectConfig = projectConfigs.get(0);
 					projectConfig = projectConfigs.get(0);
 				}
 				}
+				/*
 				if ( projectConfig == null) {
 				if ( projectConfig == null) {
 					check = false;
 					check = false;
 					Exception exception = new ProjectConfigNotExistsException( id );
 					Exception exception = new ProjectConfigNotExistsException( id );
@@ -57,13 +59,8 @@ public class ActionProjectConfigGetByProject extends BaseAction {
 		
 		
 		if( Boolean.TRUE.equals( check ) ){
 		if( Boolean.TRUE.equals( check ) ){
 			try {
 			try {
-				if(ListTools.isEmpty(projectConfigs)){
-					wo = new ArrayList<Wo>();
+					wo = Wo.copier.copy( projectConfig );					
 					result.setData(wo);
 					result.setData(wo);
-				}else{
-					wo = Wo.copier.copy( projectConfigs );					
-					result.setData(wo);
-				}
 				
 				
 			} catch (Exception e) {
 			} catch (Exception e) {
 				Exception exception = new ProjectConfigQueryException(e, "将查询出来的项目配置信息对象转换为可输出的数据信息时发生异常。");
 				Exception exception = new ProjectConfigQueryException(e, "将查询出来的项目配置信息对象转换为可输出的数据信息时发生异常。");

+ 1 - 1
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/global/GlobalAction.java

@@ -213,7 +213,7 @@ public class GlobalAction extends StandardJaxrsAction {
 	public void projectConfigGetByProject(@Suspended final AsyncResponse asyncResponse, 
 	public void projectConfigGetByProject(@Suspended final AsyncResponse asyncResponse, 
 			@Context HttpServletRequest request, 
 			@Context HttpServletRequest request, 
 			@JaxrsParameterDescribe("项目ID") @PathParam("id") String id ) {
 			@JaxrsParameterDescribe("项目ID") @PathParam("id") String id ) {
-		ActionResult<List<ActionProjectConfigGetByProject.Wo>> result = new ActionResult<>();
+		ActionResult<ActionProjectConfigGetByProject.Wo> result = new ActionResult<>();
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		EffectivePerson effectivePerson = this.effectivePerson(request);
 		try {
 		try {
 			result = new ActionProjectConfigGetByProject().execute( request, effectivePerson, id );
 			result = new ActionProjectConfigGetByProject().execute( request, effectivePerson, id );

+ 25 - 0
o2server/x_teamwork_assemble_control/src/main/java/com/x/teamwork/assemble/control/jaxrs/project/ActionListNextWithFilter.java

@@ -21,6 +21,7 @@ import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.ListTools;
 import com.x.base.core.project.tools.ListTools;
 import com.x.teamwork.assemble.control.Business;
 import com.x.teamwork.assemble.control.Business;
 import com.x.teamwork.core.entity.Project;
 import com.x.teamwork.core.entity.Project;
+import com.x.teamwork.core.entity.ProjectConfig;
 import com.x.teamwork.core.entity.tools.filter.QueryFilter;
 import com.x.teamwork.core.entity.tools.filter.QueryFilter;
 import com.x.teamwork.core.entity.tools.filter.term.InTerm;
 import com.x.teamwork.core.entity.tools.filter.term.InTerm;
 
 
@@ -105,13 +106,34 @@ public class ActionListNextWithFilter extends BaseAction {
 								try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) {
 								try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) {
 									business = new Business(bc);
 									business = new Business(bc);
 								}
 								}
+								
+								//查询项目配置信息
+								List<ProjectConfig>  projectConfigs = null;
+								projectConfigs = projectConfigQueryService.getProjectConfigByProject( project.getId() );
+								
 								control = new WrapOutControl();
 								control = new WrapOutControl();
+								
+								if(ListTools.isNotEmpty(projectConfigs)){
+									ProjectConfig projectConfig = projectConfigs.get(0);
+									control.setTaskCreate(projectConfig.getTaskCreate());
+									control.setTaskCopy(projectConfig.getTaskCopy());
+									control.setTaskRemove(projectConfig.getTaskRemove());
+									control.setLaneCreate(projectConfig.getLaneCreate());
+									control.setLaneEdit(projectConfig.getLaneEdit());
+									control.setLaneRemove(projectConfig.getLaneRemove());
+									control.setAttachmentUpload(projectConfig.getAttachmentUpload());
+									control.setComment(projectConfig.getComment());
+								}else{
+									control.setTaskCreate(true);
+								}
+								
 								if( business.isManager(effectivePerson) 
 								if( business.isManager(effectivePerson) 
 										|| effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() )
 										|| effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() )
 										|| project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) {
 										|| project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) {
 									control.setDelete( true );
 									control.setDelete( true );
 									control.setEdit( true );
 									control.setEdit( true );
 									control.setSortable( true );
 									control.setSortable( true );
+									control.setTaskCreate(true);
 								}else{
 								}else{
 									control.setDelete( false );
 									control.setDelete( false );
 									control.setEdit( false );
 									control.setEdit( false );
@@ -122,6 +144,9 @@ public class ActionListNextWithFilter extends BaseAction {
 								}else{
 								}else{
 									control.setFounder( false );
 									control.setFounder( false );
 								}
 								}
+								if(project.getDeleted() || project.getCompleted()){
+									control.setTaskCreate(false);
+								}
 								wo.setControl(control);
 								wo.setControl(control);
 								wos.add( wo );
 								wos.add( wo );
 							}
 							}