5 changed files with 301 additions and 35 deletions
@ -0,0 +1,39 @@ |
|||||
|
package com.epmet.plugin.power.dto.visit.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 海康社区人员信息下放 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DhPersonFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String paperType; |
||||
|
|
||||
|
private String paperNumber; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String code; |
||||
|
|
||||
|
private Long deptId; |
||||
|
|
||||
|
private String sex; |
||||
|
|
||||
|
private String birthday; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
private String status; |
||||
|
|
||||
|
private String personIdentityId; |
||||
|
|
||||
|
} |
@ -0,0 +1,142 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.plugin.power.modules.visit.utils; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
||||
|
import com.epmet.commons.tools.exception.ErrorCode; |
||||
|
import com.epmet.commons.tools.utils.MessageUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 响应数据 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
public class DhResult<T> implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
/** |
||||
|
* 编码:0表示成功,其他值表示失败 |
||||
|
*/ |
||||
|
private Integer code = 0; |
||||
|
/** |
||||
|
* 消息内容 |
||||
|
*/ |
||||
|
private String errMsg = "success"; |
||||
|
|
||||
|
/** |
||||
|
* 内部信息 |
||||
|
*/ |
||||
|
private Boolean success = true; |
||||
|
|
||||
|
/** |
||||
|
* 响应数据 |
||||
|
*/ |
||||
|
private T data; |
||||
|
|
||||
|
public DhResult<T> ok(T data) { |
||||
|
this.setData(data); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public boolean success(){ |
||||
|
return code == 0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 返回 |
||||
|
* "code": 8000, |
||||
|
* "msg": "服务器开小差了...", |
||||
|
*/ |
||||
|
public DhResult<T> error() { |
||||
|
this.code = EpmetErrorCode.SERVER_ERROR.getCode(); |
||||
|
this.errMsg = EpmetErrorCode.getMsg(code); |
||||
|
if (StringUtils.isBlank(this.errMsg)) { |
||||
|
this.errMsg = MessageUtils.getMessage(this.code); |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据错误编码查询msg返回 |
||||
|
*/ |
||||
|
public DhResult<T> error(int code) { |
||||
|
this.code = code; |
||||
|
this.errMsg = EpmetErrorCode.getMsg(code); |
||||
|
if (StringUtils.isBlank(this.errMsg)) { |
||||
|
this.errMsg = MessageUtils.getMessage(this.code); |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 传入错误编码+msg返回 |
||||
|
*/ |
||||
|
public DhResult<T> error(int code, String msg) { |
||||
|
this.code = code; |
||||
|
this.errMsg = msg; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param msg |
||||
|
* @return 此方法废弃,统一使用 |
||||
|
* logger.error(XXXX); |
||||
|
* throw new RenException(XXXX); |
||||
|
* XXXX定义常量里 |
||||
|
*/ |
||||
|
@Deprecated |
||||
|
public DhResult<T> error(String msg) { |
||||
|
this.code = ErrorCode.INTERNAL_SERVER_ERROR; |
||||
|
this.errMsg = msg; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public int getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public void setCode(int code) { |
||||
|
this.code = code; |
||||
|
} |
||||
|
|
||||
|
public String getErrMsg() { |
||||
|
return errMsg; |
||||
|
} |
||||
|
|
||||
|
public void setErrMsg(String errMsg) { |
||||
|
this.errMsg = errMsg; |
||||
|
} |
||||
|
|
||||
|
public T getData() { |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
public void setData(T data) { |
||||
|
this.data = data; |
||||
|
} |
||||
|
|
||||
|
public Boolean getSuccess() { |
||||
|
return success; |
||||
|
} |
||||
|
|
||||
|
public void setSuccess(Boolean success) { |
||||
|
this.success = success; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return JSON.toJSONString(this); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue