|
@@ -7,39 +7,44 @@ import javax.ws.rs.POST;
|
|
|
import javax.ws.rs.Path;
|
|
import javax.ws.rs.Path;
|
|
|
import javax.ws.rs.PathParam;
|
|
import javax.ws.rs.PathParam;
|
|
|
import javax.ws.rs.Produces;
|
|
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.Context;
|
|
|
import javax.ws.rs.core.MediaType;
|
|
import javax.ws.rs.core.MediaType;
|
|
|
-import javax.ws.rs.core.Response;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.google.gson.JsonElement;
|
|
|
import com.x.base.core.project.annotation.JaxrsDescribe;
|
|
import com.x.base.core.project.annotation.JaxrsDescribe;
|
|
|
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
|
|
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.ActionResult;
|
|
|
|
|
+import com.x.base.core.project.http.EffectivePerson;
|
|
|
import com.x.base.core.project.http.HttpMediaType;
|
|
import com.x.base.core.project.http.HttpMediaType;
|
|
|
-import com.x.base.core.project.http.WrapOutBoolean;
|
|
|
|
|
-import com.x.base.core.project.http.WrapOutInteger;
|
|
|
|
|
-import com.x.base.core.project.http.WrapOutString;
|
|
|
|
|
import com.x.base.core.project.jaxrs.ResponseFactory;
|
|
import com.x.base.core.project.jaxrs.ResponseFactory;
|
|
|
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
|
-import com.x.organization.assemble.personal.wrapin.WrapInRegist;
|
|
|
|
|
|
|
+import com.x.base.core.project.logger.Logger;
|
|
|
|
|
+import com.x.base.core.project.logger.LoggerFactory;
|
|
|
|
|
|
|
|
@Path("regist")
|
|
@Path("regist")
|
|
|
@JaxrsDescribe("注册")
|
|
@JaxrsDescribe("注册")
|
|
|
public class RegistAction extends StandardJaxrsAction {
|
|
public class RegistAction extends StandardJaxrsAction {
|
|
|
|
|
|
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(RegistAction.class);
|
|
|
|
|
+
|
|
|
@JaxrsMethodDescribe(value = "当前允许的注册模式,disable,captcha,code", action = ActionMode.class)
|
|
@JaxrsMethodDescribe(value = "当前允许的注册模式,disable,captcha,code", action = ActionMode.class)
|
|
|
@GET
|
|
@GET
|
|
|
@Path("mode")
|
|
@Path("mode")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response mode(@Context HttpServletRequest request) {
|
|
|
|
|
- ActionResult<WrapOutString> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void mode(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
|
|
|
|
|
+ ActionResult<ActionMode.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionMode().execute();
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionMode().execute(effectivePerson);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "生成一个captcha", action = ActionCaptcha.class)
|
|
@JaxrsMethodDescribe(value = "生成一个captcha", action = ActionCaptcha.class)
|
|
@@ -47,16 +52,18 @@ public class RegistAction extends StandardJaxrsAction {
|
|
|
@Path("captcha/width/{width}/height/{height}")
|
|
@Path("captcha/width/{width}/height/{height}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response captcha(@Context HttpServletRequest request, @PathParam("width") Integer width,
|
|
|
|
|
- @PathParam("height") Integer height) {
|
|
|
|
|
|
|
+ public void captcha(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ @JaxrsParameterDescribe("图像宽度") @PathParam("width") Integer width,
|
|
|
|
|
+ @JaxrsParameterDescribe("图像高度") @PathParam("height") Integer height) {
|
|
|
ActionResult<ActionCaptcha.Wo> result = new ActionResult<>();
|
|
ActionResult<ActionCaptcha.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCaptcha().execute(width, height);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCaptcha().execute(effectivePerson, width, height);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "生成一个code", action = ActionCode.class)
|
|
@JaxrsMethodDescribe(value = "生成一个code", action = ActionCode.class)
|
|
@@ -64,15 +71,17 @@ public class RegistAction extends StandardJaxrsAction {
|
|
|
@Path("code/mobile/{mobile}")
|
|
@Path("code/mobile/{mobile}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response code(@Context HttpServletRequest request, @PathParam("mobile") String mobile) {
|
|
|
|
|
- ActionResult<WrapOutBoolean> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void code(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ @JaxrsParameterDescribe("电话号码") @PathParam("mobile") String mobile) {
|
|
|
|
|
+ ActionResult<ActionCode.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCode().execute(mobile);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCode().execute(effectivePerson, mobile);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "校验mobile是否已经存在", action = ActionCheckMobile.class)
|
|
@JaxrsMethodDescribe(value = "校验mobile是否已经存在", action = ActionCheckMobile.class)
|
|
@@ -80,15 +89,17 @@ public class RegistAction extends StandardJaxrsAction {
|
|
|
@Path("check/mobile/{mobile}")
|
|
@Path("check/mobile/{mobile}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response checkMobile(@Context HttpServletRequest request, @PathParam("mobile") String mobile) {
|
|
|
|
|
- ActionResult<WrapOutBoolean> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void checkMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ @JaxrsParameterDescribe("电话号码") @PathParam("mobile") String mobile) {
|
|
|
|
|
+ ActionResult<ActionCheckMobile.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCheckMobile().execute(mobile);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCheckMobile().execute(effectivePerson, mobile);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "校验name是否已经存在", action = ActionCheckName.class)
|
|
@JaxrsMethodDescribe(value = "校验name是否已经存在", action = ActionCheckName.class)
|
|
@@ -96,15 +107,17 @@ public class RegistAction extends StandardJaxrsAction {
|
|
|
@Path("check/name/{name}")
|
|
@Path("check/name/{name}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response checkName(@Context HttpServletRequest request, @PathParam("name") String name) {
|
|
|
|
|
- ActionResult<WrapOutBoolean> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void checkName(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ @JaxrsParameterDescribe("用户名") @PathParam("name") String name) {
|
|
|
|
|
+ ActionResult<ActionCheckName.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCheckName().execute(name);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCheckName().execute(effectivePerson, name);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "校验password密码等级.", action = ActionCheckPassword.class)
|
|
@JaxrsMethodDescribe(value = "校验password密码等级.", action = ActionCheckPassword.class)
|
|
@@ -112,30 +125,34 @@ public class RegistAction extends StandardJaxrsAction {
|
|
|
@Path("check/password/{password}")
|
|
@Path("check/password/{password}")
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response checkPassword(@Context HttpServletRequest request, @PathParam("password") String password) {
|
|
|
|
|
- ActionResult<WrapOutInteger> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void checkPassword(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ @JaxrsParameterDescribe("密码") @PathParam("password") String password) {
|
|
|
|
|
+ ActionResult<ActionCheckPassword.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCheckPassword().execute(password);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCheckPassword().execute(effectivePerson, password);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, null);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JaxrsMethodDescribe(value = "注册人员", action = ActionCreate.class)
|
|
@JaxrsMethodDescribe(value = "注册人员", action = ActionCreate.class)
|
|
|
@POST
|
|
@POST
|
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
- public Response create(@Context HttpServletRequest request, WrapInRegist wrapIn) {
|
|
|
|
|
- ActionResult<WrapOutBoolean> result = new ActionResult<>();
|
|
|
|
|
|
|
+ public void create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
|
|
|
|
|
+ JsonElement jsonElement) {
|
|
|
|
|
+ ActionResult<ActionCreate.Wo> result = new ActionResult<>();
|
|
|
|
|
+ EffectivePerson effectivePerson = this.effectivePerson(request);
|
|
|
try {
|
|
try {
|
|
|
- result = new ActionCreate().execute(wrapIn);
|
|
|
|
|
- } catch (Throwable th) {
|
|
|
|
|
- th.printStackTrace();
|
|
|
|
|
- result.error(th);
|
|
|
|
|
|
|
+ result = new ActionCreate().execute(effectivePerson, jsonElement);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error(e, effectivePerson, request, jsonElement);
|
|
|
|
|
+ result.error(e);
|
|
|
}
|
|
}
|
|
|
- return ResponseFactory.getDefaultActionResultResponse(result);
|
|
|
|
|
|
|
+ asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|