|
|
@@ -0,0 +1,67 @@
|
|
|
+package com.x.cms.assemble.control.jaxrs.commend;
|
|
|
+
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+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.jaxrs.proxy.StandardJaxrsActionProxy;
|
|
|
+import com.x.base.core.project.logger.Logger;
|
|
|
+import com.x.base.core.project.logger.LoggerFactory;
|
|
|
+import com.x.cms.assemble.control.ThisApplication;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.ws.rs.*;
|
|
|
+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 java.util.List;
|
|
|
+
|
|
|
+@Path("commend")
|
|
|
+@JaxrsDescribe("点赞信息管理")
|
|
|
+public class DocumentCommendAction extends StandardJaxrsAction {
|
|
|
+
|
|
|
+ private StandardJaxrsActionProxy proxy = new StandardJaxrsActionProxy(ThisApplication.context());
|
|
|
+ private Logger logger = LoggerFactory.getLogger(DocumentCommendAction.class);
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "根据标识获取点赞对象.", action = ActionGet.class)
|
|
|
+ @GET
|
|
|
+ @Path("{id}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void get( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @JaxrsParameterDescribe("评论ID") @PathParam("id") String id) {
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson( request );
|
|
|
+ ActionResult<ActionGet.Wo> result = new ActionResult<>();
|
|
|
+ try {
|
|
|
+ result = ((ActionGet)proxy.getProxy(ActionGet.class)).execute( request, effectivePerson, id );
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "分页列示点赞对象.", action = ActionListPaging.class)
|
|
|
+ @POST
|
|
|
+ @Path("list/paging/{page}/size/{size}")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void listPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
|
|
|
+ @JaxrsParameterDescribe("每页数量") @PathParam("size") Integer size, JsonElement jsonElement) {
|
|
|
+ ActionResult<List<ActionListPaging.Wo>> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = ((ActionListPaging)proxy.getProxy(ActionListPaging.class)).execute(effectivePerson, page, size, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, jsonElement);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+}
|