Commit cb79c2a7 by s_guodong

去掉root

parent a67f26cd
......@@ -2,14 +2,12 @@ package com.ceb.gjjs.mda.resource.base;
import com.brilliance.mda.runtime.mda.driver.MdaEnv;
import com.brilliance.mda.runtime.request.BaseVO;
import com.brilliance.mda.runtime.response.RespondRoot;
import com.brilliance.mda.runtime.response.ResponseSet;
import com.brilliance.mda.support.service.ICommonService;
import com.brilliance.mda.support.td.BDAuthInfo;
import com.ceb.gjjs.mda.bo.Usr;
import com.ceb.gjjs.mda.dao.UsrMapper;
import com.ceb.gjjs.mda.special.vo.RequestBaseVo;
import com.ceb.gjjs.mda.special.vo.RequestCommonVo;
import com.ceb.gjjs.mda.util.ReflectUtil;
import com.ceb.gjjs.mda.util.ValidatorUtil;
import org.apache.commons.lang3.StringUtils;
......@@ -38,116 +36,116 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
@Path("/init")
@POST
public RespondRoot<V> init(@RequestBody V req) {
public ResponseSet<V> init(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().init(req));
return getCommonService().init(req);
}
@Path("/checkAll")
@POST
public RespondRoot checkAll(@RequestBody V req) {
public ResponseSet checkAll(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot(getCommonService().checkAll(req));
return getCommonService().checkAll(req);
}
@Path("/saveData")
@POST
public RespondRoot<V> saveData(@RequestBody V req) {
public ResponseSet<V> saveData(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().saveData(req));
return getCommonService().saveData(req);
}
@Path("/confirmData")
@POST
public RespondRoot<V> confirmData(@RequestBody V req) {
public ResponseSet<V> confirmData(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().confirmData(req));
return getCommonService().confirmData(req);
}
@Path("/pending")
@POST
public RespondRoot<V> pending(@RequestBody V req) {
public ResponseSet<V> pending(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().pending(req));
return getCommonService().pending(req);
}
@Path("/executeCheck/{rule}")
@POST
public RespondRoot<V> executeCheck(@PathParam("rule") String rule, @RequestBody V req) {
public ResponseSet<V> executeCheck(@PathParam("rule") String rule, @RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
String[] ruleArr = rule.split(",");
return new RespondRoot<>(getCommonService().executeCheck(req, ruleArr));
return getCommonService().executeCheck(req, ruleArr);
}
@Path("/executeRule/{rule}")
@POST
public RespondRoot<V> executeRule(@PathParam("rule") String rule, @RequestBody V req) {
public ResponseSet<V> executeRule(@PathParam("rule") String rule, @RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
String[] ruleArr = rule.split(",");
return new RespondRoot<>(getCommonService().executeRule(req, ruleArr));
return getCommonService().executeRule(req, ruleArr);
}
@Path("/executeDefault/{rule}")
@POST
public RespondRoot<V> executeDefault(@PathParam("rule") String rule, @RequestBody V req) {
public ResponseSet<V> executeDefault(@PathParam("rule") String rule, @RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
String[] ruleArr = rule.split(",");
return new RespondRoot<>(getCommonService().executeDefault(req, ruleArr));
return getCommonService().executeDefault(req, ruleArr);
}
@Path("/executeNotify")
@POST
public RespondRoot<V> executeNotify(@RequestBody V req) {
public ResponseSet<V> executeNotify(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().executeNotify(req));
return getCommonService().executeNotify(req);
}
@Path("/executeDocpan")
@POST
public RespondRoot<V> executeDocpan(@RequestBody V req) {
public ResponseSet<V> executeDocpan(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().executeDocpan(req));
return getCommonService().executeDocpan(req);
}
@Path("/executeDocpanDetail")
@POST
public RespondRoot<V> executeDocpanDetail(@RequestBody V req) {
public ResponseSet<V> executeDocpanDetail(@RequestBody V req) {
String checkResult = resetAndcheckParam(req);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, req);
}
return new RespondRoot<>(getCommonService().executeDocpanDetail(req));
return getCommonService().executeDocpanDetail(req);
}
......@@ -162,9 +160,8 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
}
protected <T> RespondRoot<T> executeRule(RequestCommonVo requestCommonVo, Class<T> respondVoClass, String rule) {
protected <T> ResponseSet<T> executeRule(RequestBaseVo requestBaseVo, Class<T> respondVoClass, String rule) {
V baseVO = getVo();
RequestBaseVo requestBaseVo = requestCommonVo.getRoot();
T t = null;
try {
t = respondVoClass.newInstance();
......@@ -172,11 +169,11 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
}
String s = resetAndcheckBaseParam(requestBaseVo, baseVO);
if (!StringUtils.isBlank(s)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t);
}
String checkResult = resetAndcheckParam(requestBaseVo, baseVO);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, t));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, checkResult, t);
}
String[] ruleArr = new String[]{rule};
ResponseSet responseSet = getCommonService().executeRule(baseVO, ruleArr);
......@@ -184,13 +181,12 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
ReflectUtil.setValue2RespondVo(t, respondVoClass, data, baseVO.getClass());
setTotal(t, baseVO);
responseSet.setData(t);
return new RespondRoot<>(responseSet);
return responseSet;
}
protected <T> RespondRoot<T> executeCheck(RequestCommonVo<RequestBaseVo> requestCommonVo, Class<T> respondVoClass, String rule) {
protected <T> ResponseSet<T> executeCheck(RequestBaseVo requestBaseVo, Class<T> respondVoClass, String rule) {
V baseVO = getVo();
RequestBaseVo requestBaseVo = requestCommonVo.getRoot();
T t = null;
try {
t = respondVoClass.newInstance();
......@@ -198,11 +194,11 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
}
String s = resetAndcheckBaseParam(requestBaseVo, baseVO);
if (!StringUtils.isBlank(s)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t);
}
String checkResult = resetAndcheckParam(requestBaseVo, baseVO);
if (StringUtils.isNotBlank(checkResult)) {
return new RespondRoot<>(new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t));
return new ResponseSet<>(ResponseSet.CODE_FAILURE, s, t);
}
String[] ruleArr = new String[]{rule};
ResponseSet responseSet = getCommonService().executeCheck(baseVO, ruleArr);
......@@ -210,7 +206,7 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
ReflectUtil.setValue2RespondVo(t, respondVoClass, data, baseVO.getClass());
setTotal(t, baseVO);
responseSet.setData(t);
return new RespondRoot<>(responseSet);
return responseSet;
}
......
package com.ceb.gjjs.mda.special.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/17
*/
@Data
public class RequestCommonVo<T extends RequestBaseVo> implements Serializable {
private T root;
}
package com.brilliance.mda.runtime.response;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/18
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class RespondRoot<T> implements Serializable {
private ResponseSet<T> root;
public RespondRoot(ResponseSet<T> root) {
this.root = root;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment