提交 334cde5b 编写于 作者: L luojing

teamWork服务接口

上级 cfd2b390
......@@ -14,6 +14,8 @@ import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.base.core.project.tools.ListTools;
import com.x.organization.core.entity.PersonCard;
import com.x.organization.core.entity.PersonCard_;
import com.x.teamwork.assemble.control.AbstractFactory;
import com.x.teamwork.assemble.control.Business;
import com.x.teamwork.core.entity.Dynamic_;
......@@ -241,5 +243,36 @@ public class ProjectTemplateFactory extends AbstractFactory {
return em.createQuery(cq.where(p)).setMaxResults( maxCount).getResultList();
}
/**
* 列示所有模板的分类信息
* @param distinguishName
* @return
* @throws Exception
*/
public List<String> fetchAllGroupType( String distinguishName ) throws Exception {
EntityManager em = this.entityManagerContainer().get(ProjectTemplate.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<ProjectTemplate> root = cq.from(ProjectTemplate.class);
Predicate p = cb.equal(root.get(ProjectTemplate_.deleted), false);
cq.select(root.get(ProjectTemplate_.type)).where(p).distinct(true);
return em.createQuery(cq).getResultList();
}
/**
* 根据模板类型列示模板信息
* @param type
* @return
* @throws Exception
*/
public List<ProjectTemplate> ListProjectTemplateWithType( String type ) throws Exception {
EntityManager em = this.entityManagerContainer().get(ProjectTemplate.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<ProjectTemplate> cq = cb.createQuery(ProjectTemplate.class);
Root<ProjectTemplate> root = cq.from(ProjectTemplate.class);
Predicate p = cb.equal(root.get(ProjectTemplate_.deleted), false);
p = cb.and( p, cb.equal(root.get(ProjectTemplate_.type), type));
return em.createQuery(cq.where(p)).getResultList();
}
}
......@@ -45,13 +45,13 @@ public class ActionGet extends BaseAction {
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
/*String cacheKey = ApplicationCache.concreteCacheKey( flag,effectivePerson );
Element element = projectCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData( wo );
} else {
} else {*/
if( Boolean.TRUE.equals( check ) ){
try {
project = projectQueryService.get(flag);
......@@ -107,7 +107,7 @@ public class ActionGet extends BaseAction {
control.setFounder( false );
}
wo.setControl(control);
projectCache.put(new Element(cacheKey, wo));
//projectCache.put(new Element(cacheKey, wo));
result.setData(wo);
} catch (Exception e) {
Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。");
......@@ -115,7 +115,7 @@ public class ActionGet extends BaseAction {
logger.error(e, effectivePerson, request, null);
}
}
}
//}
return result;
}
......
......@@ -37,8 +37,8 @@ public class ActionListArchiveNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -77,7 +77,7 @@ public class ActionListArchiveNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListArchiveNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListArchiveNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -85,7 +85,7 @@ public class ActionListArchiveNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -129,7 +129,7 @@ public class ActionListArchiveNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -140,7 +140,7 @@ public class ActionListArchiveNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -37,8 +37,8 @@ public class ActionListCompletedNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -77,7 +77,7 @@ public class ActionListCompletedNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListCompletedNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListCompletedNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -85,7 +85,7 @@ public class ActionListCompletedNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -129,7 +129,7 @@ public class ActionListCompletedNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -140,7 +140,7 @@ public class ActionListCompletedNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -37,8 +37,8 @@ public class ActionListMyNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -77,7 +77,7 @@ public class ActionListMyNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListMyNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListMyNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -85,7 +85,7 @@ public class ActionListMyNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -129,7 +129,7 @@ public class ActionListMyNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -140,7 +140,7 @@ public class ActionListMyNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -36,8 +36,8 @@ public class ActionListNextInGroupWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -71,7 +71,7 @@ public class ActionListNextInGroupWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextInGroupWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextInGroupWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -79,7 +79,7 @@ public class ActionListNextInGroupWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -123,7 +123,7 @@ public class ActionListNextInGroupWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -134,7 +134,7 @@ public class ActionListNextInGroupWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -74,7 +74,8 @@ public class ActionListNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*采用缓存
* cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -82,7 +83,7 @@ public class ActionListNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -126,7 +127,7 @@ public class ActionListNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -137,7 +138,7 @@ public class ActionListNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -37,8 +37,8 @@ public class ActionListNoGroupNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -77,7 +77,7 @@ public class ActionListNoGroupNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListNoGroupNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListNoGroupNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -85,7 +85,7 @@ public class ActionListNoGroupNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -129,7 +129,7 @@ public class ActionListNoGroupNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -140,7 +140,7 @@ public class ActionListNoGroupNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -34,8 +34,8 @@ public class ActionListPageInGroupWithFilter extends BaseAction {
ResultObject resultObject = null;
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -64,19 +64,19 @@ public class ActionListPageInGroupWithFilter extends BaseAction {
queryFilter.addInTerm( new InTerm("id", new ArrayList<Object>(queryProjectIds) ));
}
if( Boolean.TRUE.equals( check ) ){
/*if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListPageWithFilter", effectivePerson.getDistinguishedName(),
pageNum, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
}
}*/
if( Boolean.TRUE.equals( check ) ){
if ((null != element) && (null != element.getObjectValue())) {
/*if ((null != element) && (null != element.getObjectValue())) {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -120,7 +120,7 @@ public class ActionListPageInGroupWithFilter extends BaseAction {
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
}
......@@ -130,7 +130,7 @@ public class ActionListPageInGroupWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -36,8 +36,8 @@ public class ActionListPageWithFilter extends BaseAction {
ResultObject resultObject = null;
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -71,19 +71,19 @@ public class ActionListPageWithFilter extends BaseAction {
}
}
if( Boolean.TRUE.equals( check ) ){
/*if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListPageWithFilter", effectivePerson.getDistinguishedName(),
pageNum, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
}
}*/
if( Boolean.TRUE.equals( check ) ){
if ((null != element) && (null != element.getObjectValue())) {
/*if ((null != element) && (null != element.getObjectValue())) {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else { */
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -127,7 +127,7 @@ public class ActionListPageWithFilter extends BaseAction {
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
}
......@@ -137,7 +137,7 @@ public class ActionListPageWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -32,8 +32,8 @@ public class ActionListRecycleNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -73,7 +73,7 @@ public class ActionListRecycleNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ) {
cacheKey = ApplicationCache.concreteCacheKey( "ActionListRecycleNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListRecycleNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -81,7 +81,7 @@ public class ActionListRecycleNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllProjectIds( effectivePerson, 2000, queryFilter );
......@@ -125,7 +125,7 @@ public class ActionListRecycleNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -135,7 +135,7 @@ public class ActionListRecycleNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -37,8 +37,8 @@ public class ActionListStarNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
//String cacheKey = null;
//Element element = null;
QueryFilter queryFilter = null;
List<String> queryProjectIds = new ArrayList<>();
......@@ -77,7 +77,7 @@ public class ActionListStarNextWithFilter extends BaseAction {
}
if( Boolean.TRUE.equals( check ) ){
cacheKey = ApplicationCache.concreteCacheKey( "ActionListStarNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
/*cacheKey = ApplicationCache.concreteCacheKey( "ActionListStarNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = projectCache.get( cacheKey );
......@@ -85,7 +85,7 @@ public class ActionListStarNextWithFilter extends BaseAction {
resultObject = (ResultObject) element.getObjectValue();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
} else {*/
try {
//获取用户能查看的所有的项目信息ID列表,最多查询2000条数据
List<String> projectIds = projectQueryService.listAllViewableProjectIds( effectivePerson, 2000, queryFilter );
......@@ -129,7 +129,7 @@ public class ActionListStarNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
projectCache.put(new Element( cacheKey, resultObject ));
//projectCache.put(new Element( cacheKey, resultObject ));
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
......@@ -140,7 +140,7 @@ public class ActionListStarNextWithFilter extends BaseAction {
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
//}
}
return result;
}
......
......@@ -136,6 +136,9 @@ public class ActionSave extends BaseAction {
@FieldDescribe("执行者|负责人,非必填")
private String executor;
@FieldDescribe("模板id")
private String templateId;
@FieldDescribe("管理者,非必填")
private List<String> manageablePersonList;
......@@ -220,6 +223,14 @@ public class ActionSave extends BaseAction {
public void setExecutor(String executor) {
this.executor = executor;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public List<String> getManageablePersonList() {
return manageablePersonList;
......
......@@ -43,13 +43,13 @@ public class ActionStatisticMyProjects extends BaseAction {
Integer archiveCount = 0;
Integer deleteCount = 0;
String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjects", effectivePerson.getDistinguishedName() );
/*String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjects", effectivePerson.getDistinguishedName() );
Element element = projectCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData( wo );
} else {
} else {*/
if( Boolean.TRUE.equals( check ) ){
try {
//查询我参与的所有项目
......@@ -127,7 +127,7 @@ public class ActionStatisticMyProjects extends BaseAction {
SortTools.asc( woGroupList, "createTime");
}
wo.setGroups( woGroupList );
projectCache.put( new Element(cacheKey, wo) );
//projectCache.put( new Element(cacheKey, wo) );
result.setData(wo);
} catch (Exception e) {
Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。");
......@@ -135,7 +135,7 @@ public class ActionStatisticMyProjects extends BaseAction {
logger.error(e, effectivePerson, request, null);
}
}
}
//}
return result;
}
......
......@@ -34,13 +34,13 @@ public class ActionStatisticMyProjectsGroups extends BaseAction {
List<WoGroup> woGroupList = null;
Boolean check = true;
String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjectsGroups", effectivePerson.getDistinguishedName() );
/*String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticMyProjectsGroups", effectivePerson.getDistinguishedName() );
Element element = projectCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData( wo );
} else {
} else {*/
if( Boolean.TRUE.equals( check ) ){
try {
//查询我参与的所有项目
......@@ -92,14 +92,14 @@ public class ActionStatisticMyProjectsGroups extends BaseAction {
wo.setGroups( woGroupList );
result.setData(wo);
projectCache.put( new Element(cacheKey, wo) );
//projectCache.put( new Element(cacheKey, wo) );
} catch (Exception e) {
Exception exception = new ProjectQueryException(e, "将查询出来的应用项目信息对象转换为可输出的数据信息时发生异常。");
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
}
//}
return result;
}
......
package com.x.teamwork.assemble.control.jaxrs.projectTemplate;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
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.assemble.control.Business;
import com.x.teamwork.core.entity.ProjectTemplate;
import com.x.teamwork.core.entity.tools.filter.QueryFilter;
import net.sf.ehcache.Element;
public class ActionStatisticProjectTemplates extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionStatisticProjectTemplates.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
List<String> projectTemplateIds = null;
List<ProjectTemplate> projectTemplateList = null;
List<String> projectGroupList = null;
List<WoGroup> woGroupList = new ArrayList<>();
Business business = null;
Boolean check = true;
Integer allCount = 0;
Integer myCount = 0;
String cacheKey = ApplicationCache.concreteCacheKey( "ActionStatisticProjectTemplates", effectivePerson.getDistinguishedName() );
Element element = projectTemplateCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData( wo );
} else {
if( Boolean.TRUE.equals( check ) ){
try {
//查询所有模板
projectTemplateIds = projectTemplateQueryService.listAllProjectTemplateIds( effectivePerson, 2000, new QueryFilter() );
if( ListTools.isNotEmpty( projectTemplateIds )) {
projectTemplateList = projectTemplateQueryService.list( projectTemplateIds );
}
} catch (Exception e) {
check = false;
Exception exception = new ProjectTemplateQueryException( e, "查询所有项目模板信息列表时发生异常。" );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
if( Boolean.TRUE.equals( check ) ){
try {
//查询我所有的项目组列表
//projectGroupList = projectGroupQueryService.listGroupByPerson( effectivePerson.getDistinguishedName() );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
projectGroupList = business.projectTemplateFactory().fetchAllGroupType(effectivePerson.getDistinguishedName());
}
} catch (Exception e) {
check = false;
Exception exception = new ProjectTemplateQueryException( e, "查询用户所有项目模板信息列表时发生异常。" );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
if( Boolean.TRUE.equals( check ) ){
if( ListTools.isNotEmpty( projectTemplateList )) {
for( ProjectTemplate projectTemplate : projectTemplateList ) {
allCount++;
if( projectTemplate.getOwner().equalsIgnoreCase(effectivePerson.getDistinguishedName() )) {
myCount++;
}
}
}
}
if(Boolean.TRUE.equals( check )){
if( ListTools.isNotEmpty( projectGroupList )) {
for( String projectGroup : projectGroupList ) {
List<ProjectTemplate> templateLists = business.projectTemplateFactory().ListProjectTemplateWithType(projectGroup);
if(ListTools.isNotEmpty(templateLists)){
List<WoTemplate> woTemplate = new ArrayList<>();
WoGroup woGroup = new WoGroup();
String type = "";
woTemplate = WoTemplate.copier.copy( templateLists );
for(ProjectTemplate templateList : templateLists){
woGroup.addProjectTemplateTypeCount(1);
type = templateList.getType();
}
woGroup.setProjecTemplatetTypeName(type);
woGroup.setWoTemplate(woTemplate);
woGroupList.add(woGroup);
}
}
}
}
if( Boolean.TRUE.equals( check ) ){
try {
wo = new Wo();
wo.setAllCount( allCount );
wo.setMyCount(myCount);
//SortTools.asc( woGroupList, "projectTemplateTypeCount");
wo.setGroups( woGroupList );
projectTemplateCache.put( new Element(cacheKey, wo) );
result.setData(wo);
} catch (Exception e) {
Exception exception = new ProjectTemplateQueryException(e, "将查询出来的应用项目模板信息对象转换为可输出的数据信息时发生异常。");
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
}
return result;
}
public static class Wo{
@FieldDescribe("所有项目数量")
private Integer allCount = 0;
@FieldDescribe("所有项目数量")
private Integer myCount = 0;
@FieldDescribe("所有分组信息")
private List<WoGroup> groups = null;
public List<WoGroup> getGroups() {
return groups;
}
public void setGroups(List<WoGroup> groups) {
this.groups = groups;
}
public Integer getAllCount() {
return allCount;
}
public void setAllCount(Integer allCount) {
this.allCount = allCount;
}
public Integer getMyCount() {
return myCount;
}
public void setMyCount(Integer myCount) {
this.myCount = myCount;
}
}
public static class WoTemplate extends ProjectTemplate{
private static final long serialVersionUID = -5076990764713538973L;
public static WrapCopier<ProjectTemplate, WoTemplate> copier = WrapCopierFactory.wo( ProjectTemplate.class, WoTemplate.class, null, JpaObject.FieldsInvisible);
}
public static class WoGroup{
@FieldDescribe("分组项目数量")
private Integer projectTemplateTypeCount = 0;
@FieldDescribe("分组名称")
private String projecTemplatetTypeName;
public String getProjecTemplatetName() {
return projecTemplatetTypeName;
}
public void setProjecTemplatetTypeName(String projecTemplatetTypeName) {
this.projecTemplatetTypeName = projecTemplatetTypeName;
}
public Integer getProjectTemplateTypeCount() {
return projectTemplateTypeCount;
}
public void setProjectTemplateTypeCount(Integer projectTemplateTypeCount) {
this.projectTemplateTypeCount = projectTemplateTypeCount;
}
public void addProjectTemplateTypeCount( Integer count ) {
if( this.projectTemplateTypeCount == null ) {
this.projectTemplateTypeCount =0;
}
this.projectTemplateTypeCount += count;
}
@FieldDescribe("所有分组信息")
private List<WoTemplate> woTemplate = null;
public List<WoTemplate> getWoTemplate() {
return woTemplate;
}
public void setWoTemplate(List<WoTemplate> woTemplate) {
this.woTemplate = woTemplate;
}
}
}
\ No newline at end of file
......@@ -35,6 +35,24 @@ public class ProjectTemplateAction extends StandardJaxrsAction {
private Logger logger = LoggerFactory.getLogger(ProjectTemplateAction.class);
@JaxrsMethodDescribe(value = "查询项目模板统计信息.", action = ActionStatisticProjectTemplates.class)
@GET
@Path("statitic/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void statiticMyProject(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request ) {
ActionResult<ActionStatisticProjectTemplates.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionStatisticProjectTemplates().execute( request, effectivePerson );
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据ID查询项目模板信息.", action = ActionGet.class)
@GET
@Path("{id}")
......
......@@ -3,12 +3,20 @@ package com.x.teamwork.assemble.control.service;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.organization.core.entity.PersonCard;
import com.x.organization.core.entity.PersonCard_;
import com.x.teamwork.core.entity.Project;
import com.x.teamwork.core.entity.ProjectDetail;
import com.x.teamwork.core.entity.ProjectTemplate;
......@@ -47,7 +55,7 @@ public class ProjectTemplateQueryService {
}
/**
* 根据项目的标识查询项目信息
* 根据项目模板的标识查询模板对应的泳道信息
* @param id
* @return
* @throws Exception
......@@ -91,17 +99,17 @@ public class ProjectTemplateQueryService {
}
/**
* 根据ID列表查询项目信息列表
* 根据ID列表查询项目模板信息列表
* @param ids
* @return
* @throws Exception
*/
public List<Project> list(List<String> ids) throws Exception {
public List<ProjectTemplate> list(List<String> ids) throws Exception {
if (ListTools.isEmpty( ids )) {
return null;
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.list( Project.class, ids );
return emc.list( ProjectTemplate.class, ids );
} catch (Exception e) {
throw e;
}
......
......@@ -10,6 +10,9 @@ import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.project.tools.ListTools;
import com.x.teamwork.assemble.control.Business;
import com.x.teamwork.assemble.control.jaxrs.list.ActionListWithTaskGroup.Wo;
import com.x.teamwork.core.entity.Project;
import com.x.teamwork.core.entity.ProjectTemplate;
import com.x.teamwork.core.entity.TaskGroup;
import com.x.teamwork.core.entity.TaskList;
import com.x.teamwork.core.entity.TaskListRele;
......@@ -226,23 +229,48 @@ class TaskListService {
TaskList taskList = null;
if( taskGroup != null ) {
emc.beginTransaction( TaskList.class );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已规划的工作", 1, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已分解的任务", 21, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
Project project = emc.find( taskGroup.getProject(), Project.class );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "进行中的任务", 3, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
emc.beginTransaction( TaskList.class );
if(project != null && StringUtils.isNotEmpty( project.getTemplateId() )){
//如果有模板id,则按模板创建泳道,否则创建默认的四个泳道
ProjectTemplate projectTemplate = emc.find( project.getTemplateId(), ProjectTemplate.class );
if(projectTemplate != null){
List<String> taskListNames = null;
taskListNames = projectTemplate.getTaskList();
if(ListTools.isNotEmpty( taskListNames )){
int nameCount = 0;
for( String taskListName : taskListNames ) {
nameCount++;
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, taskListName, nameCount, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
}
}else{
throw new Exception("TaskListTemplate not exists!ProjectTemplateID:" + project.getTemplateId() );
}
}else{
throw new Exception("ProjectTemplate not exists!ID:" + project.getTemplateId() );
}
}else{
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已规划的工作", 1, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已分解的任务", 2, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "进行中的任务", 3, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已完成的任务", 4, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
}
taskList = composeTaskListObject( taskGroup.getProject(), taskGroupId, "已完成的任务", 4, "SYSTEM", person, "" );
emc.persist( taskList, CheckPersistType.all );
taskLists.add( taskList );
emc.commit();
}
......
......@@ -133,6 +133,13 @@ public class Project extends SliceJpaObject {
@Index( name = TABLE + IndexNameMiddle + executor_FIELDNAME )
@CheckPersist(allowEmpty = true)
private String executor;
public static final String templateId_FIELDNAME = "templateId";
@FieldDescribe("模板id")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + templateId_FIELDNAME)
@Index( name = TABLE + IndexNameMiddle + templateId_FIELDNAME )
@CheckPersist(allowEmpty = true)
private String templateId;
public static final String starPersonList_FIELDNAME = "starPersonList";
@FieldDescribe("标星人员")
......@@ -255,6 +262,14 @@ public class Project extends SliceJpaObject {
public void setExecutor(String executor) {
this.executor = executor;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public List<String> getParticipantPersonList() {
return participantPersonList;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册