|
|
@@ -4,7 +4,10 @@ import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.ws.rs.Consumes;
|
|
|
+import javax.ws.rs.DELETE;
|
|
|
import javax.ws.rs.GET;
|
|
|
+import javax.ws.rs.POST;
|
|
|
+import javax.ws.rs.PUT;
|
|
|
import javax.ws.rs.Path;
|
|
|
import javax.ws.rs.PathParam;
|
|
|
import javax.ws.rs.Produces;
|
|
|
@@ -13,6 +16,7 @@ import javax.ws.rs.container.Suspended;
|
|
|
import javax.ws.rs.core.Context;
|
|
|
import javax.ws.rs.core.MediaType;
|
|
|
|
|
|
+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;
|
|
|
@@ -76,9 +80,8 @@ public class RecordAction extends StandardJaxrsAction {
|
|
|
@Path("list/job/{job}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public void listWithJob(@Suspended final AsyncResponse asyncResponse,
|
|
|
- @Context HttpServletRequest request,
|
|
|
- @JaxrsParameterDescribe("工作的job") @PathParam("job") String job) {
|
|
|
+ public void listWithJob(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("工作的job") @PathParam("job") String job) {
|
|
|
ActionResult<List<ActionListWithJob.Wo>> result = new ActionResult<>();
|
|
|
EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
|
@@ -95,16 +98,32 @@ public class RecordAction extends StandardJaxrsAction {
|
|
|
@Path("list/job/{job}/paging/{page}/size/{size}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public void listWithJobPaging(@Suspended final AsyncResponse asyncResponse,
|
|
|
- @Context HttpServletRequest request,
|
|
|
- @JaxrsParameterDescribe("工作的job") @PathParam("job") String job,
|
|
|
- @JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
|
|
|
- @JaxrsParameterDescribe("数量") @PathParam("size") Integer size) {
|
|
|
+ public void listWithJobPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("工作的job") @PathParam("job") String job,
|
|
|
+ @JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
|
|
|
+ @JaxrsParameterDescribe("数量") @PathParam("size") Integer size) {
|
|
|
ActionResult<List<ActionListWithJobPaging.Wo>> result = new ActionResult<>();
|
|
|
EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
|
- result = new ActionListWithJobPaging().execute(effectivePerson, job, page,
|
|
|
- size);
|
|
|
+ result = new ActionListWithJobPaging().execute(effectivePerson, job, page, size);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "管理删除记录.", action = ActionManageDelete.class)
|
|
|
+ @DELETE
|
|
|
+ @Path("{id}/manage")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void manageDelete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("标识") @PathParam("id") String id) {
|
|
|
+ ActionResult<ActionManageDelete.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionManageDelete().execute(effectivePerson, id);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e, effectivePerson, request, null);
|
|
|
result.error(e);
|
|
|
@@ -112,4 +131,39 @@ public class RecordAction extends StandardJaxrsAction {
|
|
|
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
}
|
|
|
|
|
|
+ @JaxrsMethodDescribe(value = "管理根据job创建记录.", action = ActionManageCreateWithJob.class)
|
|
|
+ @POST
|
|
|
+ @Path("job/{job}/manage")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void manageCreateWithJob(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("标识") @PathParam("job") String job, JsonElement jsonElement) {
|
|
|
+ ActionResult<ActionManageCreateWithJob.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionManageCreateWithJob().execute(effectivePerson, job, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
+
|
|
|
+ @JaxrsMethodDescribe(value = "管理修改记录.", action = ActionManageEdit.class)
|
|
|
+ @PUT
|
|
|
+ @Path("{id}/manage")
|
|
|
+ @Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
+ @Consumes(MediaType.APPLICATION_JSON)
|
|
|
+ public void manageEdit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
+ @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
|
|
|
+ ActionResult<ActionManageEdit.Wo> result = new ActionResult<>();
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
+ try {
|
|
|
+ result = new ActionManageEdit().execute(effectivePerson, id, jsonElement);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
+ result.error(e);
|
|
|
+ }
|
|
|
+ asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
|
|
|
+ }
|
|
|
}
|