提交 d1a9d90b 编写于 作者: L luojing

teamwork后台服务

上级 b5c1478f
......@@ -42,17 +42,14 @@ public class PriorityFactory extends AbstractFactory {
* @return
* @throws Exception
*/
public List<Priority> list( List<String> ids ) throws Exception {
if( ids == null || ids.size() == 0 ){
return new ArrayList<Priority>();
}
public List<Priority> listPriority() throws Exception {
EntityManager em = this.entityManagerContainer().get(Priority.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Priority> cq = cb.createQuery(Priority.class);
Root<Priority> root = cq.from(Priority.class);
Predicate p = root.get(Priority_.id).in(ids);
cq.orderBy( cb.desc( root.get( Priority_.updateTime ) ) );
return em.createQuery(cq.where(p)).getResultList();
//Predicate p = cb.equal( root.get(Priority_.owner), person );
cq.orderBy( cb.asc( root.get( Priority_.order ) ) );
return em.createQuery(cq).getResultList();
}
/**
......@@ -86,6 +83,7 @@ public class PriorityFactory extends AbstractFactory {
CriteriaQuery<Priority> cq = cb.createQuery(Priority.class);
Root<Priority> root = cq.from(Priority.class);
//Predicate p = cb.equal( root.get(Priority_.owner), person );
cq.orderBy( cb.desc( root.get( Priority_.order ) ) );
return em.createQuery(cq).getResultList();
}
}
......@@ -31,11 +31,11 @@ public class ActionPriorityList extends BaseAction {
List<Priority> prioritys = null;
try {
prioritys = priorityQueryService.listPriorityByPerson( effectivePerson.getDistinguishedName() );
prioritys = priorityQueryService.listPriority();
if( ListTools.isNotEmpty( prioritys )) {
wos = Wo.copier.copy( prioritys );
SortTools.asc( wos, "createTime");
//SortTools.asc( wos, "createTime");
result.setData(wos);
}
result.setData(wos);
......
......@@ -406,6 +406,26 @@ public class ProjectAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据标识设置项目是否可新建任务.", action = ActionCreateable.class)
@PUT
@Path("{id}/createable")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void createableProject(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("需要保存的项目状态信息") JsonElement jsonElement ) {
ActionResult<ActionCreateable.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionCreateable().execute(request, effectivePerson, id, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据标识删除项目信息.", action = ActionDelete.class)
@DELETE
@Path("{id}")
......
......@@ -17,7 +17,7 @@ public class WrapOutControl {
private Boolean founder = false;
@FieldDescribe("是否可新建任务")
private Boolean createable = false;
private Boolean createable = true;
public Boolean getDelete() {
return delete;
......
......@@ -404,7 +404,7 @@ public class ActionSave extends BaseAction {
private String workStatus = "processing";
@FieldDescribe("工作优先级:普通 | 紧急 | 特急 ,非必填")
private String priority = "普通";
private String priority;
@FieldDescribe("提醒关联任务,非必填")
private Boolean remindRelevance;
......
......@@ -51,6 +51,20 @@ public class PriorityQueryService {
}
}
/**
* 根据用户列示优先级信息列表
* @param person
* @return
* @throws Exception
*/
public List<Priority> listPriority() throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return priorityService.listPriority(emc);
} catch (Exception e) {
throw e;
}
}
/**
* 根据用户列示优先级信息列表
* @param person
......
......@@ -130,6 +130,18 @@ class PriorityService {
}
}
/**
* 根据用户列示所有的优先级信息列表
* @param emc
* @param person
* @return
* @throws Exception
*/
protected List<Priority> listPriority( EntityManagerContainer emc) throws Exception {
Business business = new Business( emc );
return business.priorityFactory().listPriority();
}
/**
* 根据用户列示所有的优先级信息列表
* @param emc
......
......@@ -13,6 +13,7 @@ import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.teamwork.assemble.common.date.DateOperation;
import com.x.teamwork.assemble.control.Business;
import com.x.teamwork.core.entity.Priority;
import com.x.teamwork.core.entity.Project;
import com.x.teamwork.core.entity.Review;
import com.x.teamwork.core.entity.Task;
......@@ -90,9 +91,15 @@ public class TaskPersistService {
if( StringUtils.isEmpty( task.getExecutor() ) ) {
task.setExecutor( effectivePerson.getDistinguishedName() );
}
if( StringUtils.isEmpty( task.getPriority() ) ) {
task.setPriority( "普通" );
PriorityQueryService priorityQueryService = new PriorityQueryService();
List<Priority> prioritys = priorityQueryService.listPriorityByPerson( effectivePerson.getDistinguishedName() );
if( ListTools.isNotEmpty( prioritys )) {
Priority priority = prioritys.get(0);
if(priority != null){
task.setPriority(priority.getPriority()+"||"+priority.getPriorityColor() );
}
}
}
if( StringUtils.isEmpty( task.getWorkStatus() ) ) {
......@@ -476,7 +483,14 @@ public class TaskPersistService {
}else if( Task.workStatus_FIELDNAME.equalsIgnoreCase( property )) {
task.setWorkStatus( mainValue );
} else if( Task.priority_FIELDNAME.equalsIgnoreCase( property )) {
task.setPriority( mainValue );
PriorityQueryService priorityQueryService = new PriorityQueryService();
if( StringUtils.isNotEmpty( mainValue )) {
Priority priority = priorityQueryService.get(mainValue);
if(priority != null){
task.setPriority(priority.getPriority()+"||"+priority.getPriorityColor() );
}
}
//task.setPriority( mainValue );
} else if( Task.executor_FIELDNAME.equalsIgnoreCase( property )) {
if( StringUtils.isNotEmpty( mainValue )) {
String personName = null, personIdentity = null, personUnit = null;
......
package com.x.teamwork.core.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
/**
* 优先级信息
*
* @author O2LJ
*
*/
@ContainerEntity
@Entity
@Table(name = PersistenceProperties.Config.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Config.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Config extends SliceJpaObject {
private static final long serialVersionUID = 3856138316794473794L;
private static final String TABLE = PersistenceProperties.Config.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
public void onPersist() throws Exception {
/** 生成默认排序号 */
if (null == this.order) {
this.order = DateTools.timeOrderNumber();
}
}
/*
* =========================================================================
* ========= 以上为 JpaObject 默认字段
* =========================================================================
* =========
*/
/*
* =========================================================================
* ========= 以下为具体不同的业务及数据表字段要求
* =========================================================================
* =========
*/
public static final String relationId_FIELDNAME = "relationId";
@FieldDescribe("关联对象id.")
@Column(length = length_id, name = ColumnNamePrefix + relationId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + relationId_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String relationId;
public static final String type_FIELDNAME = "type";
@FieldDescribe("配置类型")
@Column( length = JpaObject.length_16B, name = ColumnNamePrefix + type_FIELDNAME)
@CheckPersist( allowEmpty = true )
private String type;
public static final String order_FIELDNAME = "order";
@FieldDescribe("排序号")
@Column( name = ColumnNamePrefix + order_FIELDNAME )
private Integer order;
public static final String owner_FIELDNAME = "owner";
@FieldDescribe("创建者")
@Column( length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + owner_FIELDNAME)
@Index( name = TABLE + IndexNameMiddle + owner_FIELDNAME )
@CheckPersist(allowEmpty = true)
private String owner;
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册