netty-调证DTO路径

This commit is contained in:
limqhz
2020-07-07 10:59:14 +08:00
parent 0e5caf23a6
commit 4436e9e6d9
2 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,148 @@
package com.sv.netty.dto;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 会员基本信息
* MemberDto.java
*
* @author peakren
* @date 2018/12/20 8:39 PM
*/
public class MemberDto implements Serializable {
/**
* 头像
*/
private String avatar;
/**
* 姓名
*/
private String name;
/**
* 手机号码
*/
private String mobile;
/**
* 余额
*/
private BigDecimal amount;
/**
* 是否第一次进入
*/
private boolean first = false;
/**
* 场地价格
*/
private BigDecimal placePrice;
/**
* 场地名称
*/
private String placeName;
/**
* 会员卡名称
*/
private String cardName;
private String message;
/**
* 1成功进场 0不允许进场
*/
private int code;
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getPlaceName() {
return placeName;
}
public void setPlaceName(String placeName) {
this.placeName = placeName;
}
public String getCardName() {
return cardName;
}
public void setCardName(String cardName) {
this.cardName = cardName;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public BigDecimal getPlacePrice() {
return placePrice;
}
public void setPlacePrice(BigDecimal placePrice) {
this.placePrice = placePrice;
}
public boolean isFirst() {
return first;
}
public void setFirst(boolean first) {
this.first = first;
}
}

View File

@@ -0,0 +1,60 @@
package com.sv.netty.dto;
import org.springframework.util.Assert;
import java.util.LinkedHashMap;
public class ResponseDTO extends LinkedHashMap<String, Object> {
public static final String ERR_CODE = "err_code";
public static final String ERR_MSG = "err_msg";
public static final String TIMESTAMP = "timestamp";
private static final long serialVersionUID = 8410965932046471023L;
public ResponseDTO() {
this(0, "OK");
}
public ResponseDTO(Integer errCode, String errMsg) {
this(errCode, errMsg, System.currentTimeMillis() / 1000L);
}
public ResponseDTO(Integer errCode, String errMsg, Long timestamp) {
this.addAttribute("err_code", errCode);
this.addAttribute("err_msg", errMsg);
this.addAttribute("timestamp", timestamp);
}
public ResponseDTO(Integer errCode, String errMsg, String attrName, Object attrValue) {
this(errCode, errMsg);
this.addAttribute(attrName, attrValue);
}
public static ResponseDTO ok() {
return new ResponseDTO();
}
public static ResponseDTO ok(String msg) {
ResponseDTO ret = ok();
ret.setErrorMsg(msg);
return ret;
}
public ResponseDTO addAttribute(String attrName, Object attrValue) {
Assert.notNull(attrName, "属性名称不能为空");
this.put(attrName, attrValue);
return this;
}
public void setErrorCode(Integer errCode) {
this.addAttribute("err_code", errCode);
}
public void setErrorMsg(String errMsg) {
this.addAttribute("err_msg", errMsg);
}
}