提交 cb4e19ff 编写于 作者: Z zhourui

增加待办已办Anonymous接口

上级 1024699e
......@@ -5,6 +5,7 @@ import java.util.Set;
import javax.ws.rs.ApplicationPath;
import com.x.base.core.project.jaxrs.AbstractActionApplication;
import com.x.processplatform.assemble.surface.jaxrs.anonymous.AnonymousAction;
import com.x.processplatform.assemble.surface.jaxrs.application.ApplicationAction;
import com.x.processplatform.assemble.surface.jaxrs.applicationdict.ApplicationDictAction;
import com.x.processplatform.assemble.surface.jaxrs.attachment.AttachmentAction;
......@@ -63,6 +64,7 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(ServiceAction.class);
classes.add(DraftAction.class);
classes.add(SnapAction.class);
classes.add(AnonymousAction.class);
return classes;
}
}
package com.x.processplatform.assemble.surface.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.AnonymousCipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/anonymous/*", asyncSupported = true)
public class AnonymousJaxrsFilter extends AnonymousCipherManagerUserJaxrsFilter {
}
package com.x.processplatform.assemble.surface.jaxrs.anonymous;
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.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
class ActionReadCountWithPerson extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String credential) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Wo wrap = new Wo();
Business business = new Business(emc);
String person = business.organization().person().get(credential);
if (StringUtils.isNotEmpty(person)) {
Long count = business.read().countWithPerson(person);
wrap.setCount(count);
}
result.setData(wrap);
return result;
}
}
public static class Wo extends GsonPropertyObject {
private static final long serialVersionUID = -6282434800524535886L;
@FieldDescribe("待阅数量")
private Long count = 0L;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}
}
\ No newline at end of file
package com.x.processplatform.assemble.surface.jaxrs.anonymous;
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.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
class ActionTaskCountWithPerson extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String credential) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Wo wo = new Wo();
Business business = new Business(emc);
String person = business.organization().person().get(credential);
if (StringUtils.isNotEmpty(person)) {
Long count = business.task().countWithPerson(person);
wo.setCount(count);
}
result.setData(wo);
return result;
}
}
public static class Wo extends GsonPropertyObject {
private static final long serialVersionUID = 8792811593252273112L;
@FieldDescribe("待办数量")
private Long count = 0L;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}
}
\ No newline at end of file
package com.x.processplatform.assemble.surface.jaxrs.anonymous;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@Path("anonymous")
@JaxrsDescribe("匿名访问")
public class AnonymousAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(AnonymousAction.class);
@JaxrsMethodDescribe(value = "获取指定人员的待办数量,没有权限限制.", action = ActionTaskCountWithPerson.class)
@GET
@Path("task/count/{credential}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void taskCountWithPerson(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("个人标识") @PathParam("credential") String credential) {
ActionResult<ActionTaskCountWithPerson.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTaskCountWithPerson().execute(effectivePerson, credential);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取指定人员的待阅数量,没有权限限制.", action = ActionReadCountWithPerson.class)
@GET
@Path("read/count/{credential}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void readCountWithPerson(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("个人标识") @PathParam("credential") String credential) {
ActionResult<ActionReadCountWithPerson.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionReadCountWithPerson().execute(effectivePerson, credential);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
package com.x.processplatform.assemble.surface.jaxrs.anonymous;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
abstract class BaseAction extends StandardJaxrsAction {
}
......@@ -4,167 +4,4 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
abstract class BaseAction extends StandardJaxrsAction {
// public static abstract class FilterWi extends GsonPropertyObject {
//
// @FieldDescribe("应用")
// private List<String> applicationList;
//
// @FieldDescribe("流程")
// private List<String> processList;
//
// @FieldDescribe("开始时间yyyy-MM-dd HH:mm:ss")
// private String startTime;
//
// @FieldDescribe("结束时间yyyy-MM-dd HH:mm:ss")
// private String endTime;
//
// @FieldDescribe("创建用户")
// private List<String> creatorPersonList;
//
// @FieldDescribe("创建组织")
// private List<String> creatorUnitList;
//
// @FieldDescribe("开始时间")
// private List<String> startTimeMonthList;
//
// @FieldDescribe("结束时间")
// private List<String> completedTimeMonthList;
//
// @FieldDescribe("是否已经结束")
// private Boolean completed;
//
// public Boolean getCompleted() {
// return completed;
// }
//
// public void setCompleted(Boolean completed) {
// this.completed = completed;
// }
//
// @FieldDescribe("关键字")
// private String key;
//
// public List<String> getApplicationList() {
// return applicationList;
// }
//
// public void setApplicationList(List<String> applicationList) {
// this.applicationList = applicationList;
// }
//
// public List<String> getProcessList() {
// return processList;
// }
//
// public void setProcessList(List<String> processList) {
// this.processList = processList;
// }
//
// public List<String> getStartTimeMonthList() {
// return startTimeMonthList;
// }
//
// public void setStartTimeMonthList(List<String> startTimeMonthList) {
// this.startTimeMonthList = startTimeMonthList;
// }
//
// public String getKey() {
// return key;
// }
//
// public void setKey(String key) {
// this.key = key;
// }
//
// public List<String> getCreatorUnitList() {
// return creatorUnitList;
// }
//
// public void setCreatorUnitList(List<String> creatorUnitList) {
// this.creatorUnitList = creatorUnitList;
// }
//
// public String getStartTime() {
// return startTime;
// }
//
// public void setStartTime(String startTime) {
// this.startTime = startTime;
// }
//
// public String getEndTime() {
// return endTime;
// }
//
// public void setEndTime(String endTime) {
// this.endTime = endTime;
// }
//
// public List<String> getCreatorPersonList() {
// return creatorPersonList;
// }
//
// public void setCreatorPersonList(List<String> creatorPersonList) {
// this.creatorPersonList = creatorPersonList;
// }
//
// public List<String> getCompletedTimeMonthList() {
// return completedTimeMonthList;
// }
//
// public void setCompletedTimeMonthList(List<String> completedTimeMonthList) {
// this.completedTimeMonthList = completedTimeMonthList;
// }
// }
//
// Predicate toFilterPredicate(EffectivePerson effectivePerson, Business business, FilterWi wi) throws Exception {
// EntityManager em = business.entityManagerContainer().get(Review.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);
// Root<Review> root = cq.from(Review.class);
// Predicate p = cb.equal(root.get(Review_.person), effectivePerson.getDistinguishedName());
// if (ListTools.isNotEmpty(wi.getApplicationList())) {
// p = cb.and(p, root.get(Review_.application).in(wi.getApplicationList()));
// }
// if (ListTools.isNotEmpty(wi.getProcessList())) {
// p = cb.and(p, root.get(Review_.process).in(wi.getProcessList()));
// }
// if (DateTools.isDateTimeOrDate(wi.getStartTime())) {
// p = cb.and(p, cb.greaterThan(root.get(Review_.startTime), DateTools.parse(wi.getStartTime())));
// }
// if (DateTools.isDateTimeOrDate(wi.getEndTime())) {
// p = cb.and(p, cb.lessThan(root.get(Review_.startTime), DateTools.parse(wi.getEndTime())));
// }
// if (ListTools.isNotEmpty(wi.getProcessList())) {
// List<String> person_ids = business.organization().person().list(wi.getCreatorPersonList());
// p = cb.and(p, root.get(Review_.creatorPerson).in(person_ids));
// }
// if (ListTools.isNotEmpty(wi.getCreatorUnitList())) {
// List<String> unit_ids = business.organization().unit().list(wi.getCreatorUnitList());
// p = cb.and(p, root.get(Review_.creatorUnit).in(unit_ids));
// }
// if (ListTools.isNotEmpty(wi.getStartTimeMonthList())) {
// p = cb.and(p, root.get(Review_.startTimeMonth).in(wi.getStartTimeMonthList()));
// }
// if (ListTools.isNotEmpty(wi.getCompletedTimeMonthList())) {
// p = cb.and(p, root.get(Review_.completedTimeMonth).in(wi.getCompletedTimeMonthList()));
// }
// if (null != wi.getCompleted()) {
// if (BooleanUtils.isTrue(wi.getCompleted())) {
// p = cb.and(p, cb.equal(root.get(Review_.completed), true));
// } else {
// p = cb.and(p,
// cb.or(cb.isNull(root.get(Review_.completed)), cb.equal(root.get(Review_.completed), false)));
// }
// }
// String key = StringTools.escapeSqlLikeKey(wi.getKey());
// if (StringUtils.isNotEmpty(key)) {
// key = "%" + key + "%";
// p = cb.and(p, cb.or(cb.like(root.get(Review_.title), key), cb.like(root.get(Review_.serial), key),
// cb.like(root.get(Review_.creatorPerson), key), cb.like(root.get(Review_.creatorUnit), key)));
// }
// return p;
// }
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册