提交 da010299 编写于 作者: L luojing

人员组织导入导出服务

上级 c86de453
......@@ -10,46 +10,43 @@ import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
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.Priority;
import com.x.teamwork.core.entity.ProjectConfig;
import com.x.teamwork.core.entity.ProjectGroup;
import net.sf.ehcache.Element;
public class ActionProjectConfigGetByProject extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionProjectConfigGetByProject.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
ProjectConfig projectConfig = null;
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;
List<ProjectConfig> projectConfigs = null;
Boolean check = true;
if ( StringUtils.isEmpty( id ) ) {
check = false;
Exception exception = new PriorityFlagForQueryEmptyException();
Exception exception = new ProjectConfigFlagForQueryEmptyException();
result.error( exception );
}
if( Boolean.TRUE.equals( check ) ){
try {
projectConfigs = projectConfigQueryService.getProjectConfigByProject( id );
if(ListTools.isNotEmpty(projectConfigs)){
/*if(ListTools.isNotEmpty(projectConfigs)){
projectConfig = projectConfigs.get(0);
}
if ( projectConfig == null) {
check = false;
Exception exception = new ProjectConfigNotExistsException( id );
result.error( exception );
}
}*/
} catch (Exception e) {
check = false;
Exception exception = new ProjectConfigQueryException(e, "根据指定flag查询项目配置信息对象时发生异常。id:" + id );
......@@ -60,8 +57,14 @@ public class ActionProjectConfigGetByProject extends BaseAction {
if( Boolean.TRUE.equals( check ) ){
try {
wo = Wo.copier.copy( projectConfig );
result.setData(wo);
if(ListTools.isEmpty(projectConfigs)){
wo = new ArrayList<Wo>();
result.setData(wo);
}else{
wo = Wo.copier.copy( projectConfigs );
result.setData(wo);
}
} catch (Exception e) {
Exception exception = new ProjectConfigQueryException(e, "将查询出来的项目配置信息对象转换为可输出的数据信息时发生异常。");
result.error(exception);
......
......@@ -213,7 +213,7 @@ public class GlobalAction extends StandardJaxrsAction {
public void projectConfigGetByProject(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("项目ID") @PathParam("id") String id ) {
ActionResult<ActionProjectConfigGetByProject.Wo> result = new ActionResult<>();
ActionResult<List<ActionProjectConfigGetByProject.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionProjectConfigGetByProject().execute( request, effectivePerson, id );
......
......@@ -20,6 +20,7 @@ import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.teamwork.assemble.control.Business;
import com.x.teamwork.core.entity.Project;
import com.x.teamwork.core.entity.ProjectConfig;
import com.x.teamwork.core.entity.ProjectDetail;
import com.x.teamwork.core.entity.ProjectGroup;
import com.x.teamwork.core.entity.Task;
......@@ -37,6 +38,7 @@ public class ActionGet extends BaseAction {
List<String> groupIds = null;
List<ProjectGroup> groups = null;
List<Task> taskList = null;
List<ProjectConfig> projectConfigs = null;
WrapOutControl control = null;
Boolean check = true;
......@@ -110,32 +112,44 @@ public class ActionGet extends BaseAction {
groups = projectGroupQueryService.list( groupIds );
wo.setGroups( groups );
//查询项目配置信息
projectConfigs = projectConfigQueryService.getProjectConfigByProject( project.getId() );
Business business = null;
try (EntityManagerContainer bc = EntityManagerContainerFactory.instance().create()) {
business = new Business(bc);
}
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)
|| effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson() )
|| project.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) {
control.setDelete( true );
control.setEdit( true );
control.setSortable( true );
control.setCreateable(true);
control.setTaskCreate(true);
}else{
control.setDelete( false );
control.setEdit( false );
control.setSortable( false );
if(project.getCreateable()){
control.setCreateable(true);
}else{
control.setCreateable(false);
}
}
if(project.getDeleted() || project.getCompleted()){
control.setCreateable(false);
control.setTaskCreate(false);
}
if(effectivePerson.getDistinguishedName().equalsIgnoreCase( project.getCreatorPerson())){
control.setFounder( true );
......
......@@ -3,6 +3,7 @@ package com.x.teamwork.assemble.control.jaxrs.project;
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.ProjectConfigQueryService;
import com.x.teamwork.assemble.control.service.ProjectGroupPersistService;
import com.x.teamwork.assemble.control.service.ProjectGroupQueryService;
import com.x.teamwork.assemble.control.service.ProjectPersistService;
......@@ -29,4 +30,6 @@ public class BaseAction extends StandardJaxrsAction {
protected SystemConfigQueryService systemConfigQueryService = new SystemConfigQueryService();
protected ProjectConfigQueryService projectConfigQueryService = new ProjectConfigQueryService();
}
......@@ -16,8 +16,30 @@ public class WrapOutControl {
@FieldDescribe("是否创始人")
private Boolean founder = false;
@FieldDescribe("是否可新建任务")
private Boolean createable = true;
private Boolean taskCreate = true;
@FieldDescribe("是否可复制任务")
private Boolean taskCopy = true;
@FieldDescribe("是否可删除任务")
private Boolean taskRemove = true;
@FieldDescribe("是否可新建泳道")
private Boolean laneCreate = true;
@FieldDescribe("是否可编辑泳道")
private Boolean laneEdit = true;
@FieldDescribe("是否可删除泳道")
private Boolean laneRemove = true;
@FieldDescribe("是否上传附件")
private Boolean attachmentUpload = true;
@FieldDescribe("是否允许评论")
private Boolean comment = true;
public Boolean getDelete() {
return delete;
......@@ -51,12 +73,67 @@ public class WrapOutControl {
this.founder = founder;
}
public Boolean getCreateable() {
return createable;
public Boolean getTaskCreate() {
return taskCreate;
}
public void setTaskCreate(Boolean taskCreate) {
this.taskCreate = taskCreate;
}
public Boolean getTaskCopy() {
return taskCopy;
}
public void setCreateable(Boolean createable) {
this.createable = createable;
public void setTaskCopy(Boolean taskCopy) {
this.taskCopy = taskCopy;
}
public Boolean getTaskRemove() {
return taskRemove;
}
public void setTaskRemove(Boolean taskRemove) {
this.taskRemove = taskRemove;
}
public Boolean getLaneCreate() {
return laneCreate;
}
public void setLaneCreate(Boolean laneCreate) {
this.laneCreate = laneCreate;
}
public Boolean getLaneEdit() {
return laneEdit;
}
public void setLaneEdit(Boolean laneEdit) {
this.laneEdit = laneEdit;
}
public Boolean getLaneRemove() {
return laneRemove;
}
public void setLaneRemove(Boolean laneRemove) {
this.laneRemove = laneRemove;
}
public Boolean getAttachmentUpload() {
return attachmentUpload;
}
public void setAttachmentUpload(Boolean attachmentUpload) {
this.attachmentUpload = attachmentUpload;
}
public Boolean getComment() {
return comment;
}
public void setComment(Boolean comment) {
this.comment = comment;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册