风险项依赖治理

This commit is contained in:
anran.war 2021-12-10 13:00:39 +08:00 committed by anruence
parent f2c2b929e3
commit fa6f63948b
252 changed files with 5190 additions and 5590 deletions

View File

@ -4,7 +4,7 @@
有问题或者宝贵意见联系我的QQ,非常希望你的加入!
##要求:
1.lombook-- idea插件请大家下载 ,去除setget构造方法等,阿里巴巴代码规范插件请自行下载<br>
1.lombok-- idea插件请大家下载 ,去除setget构造方法等,阿里巴巴代码规范插件请自行下载<br>
2.**尽量将长的类名,方法名,变量名精简**<br>
1.长的类名会使开发者不易生命该类型的变量

View File

@ -10,54 +10,54 @@ import java.math.BigDecimal;
/**
* 用户的帐户信息账户 一个LoginInfo 对应一个UserInfo对应一个Account
*
*
* @author 邱润泽
*/
@Getter
@Setter
@Alias("Account")
public class Account extends BaseDomain {
private static final long serialVersionUID = 6760287512112252557L;
private int version;
private String tradePassword; // 交易密码
private BigDecimal usableAmount = BidConst.ZERO; // 可用余额
private BigDecimal freezedAmount = BidConst.ZERO; // 冻结金额
private BigDecimal unReceiveInterest = BidConst.ZERO; // 账户待收利息
private BigDecimal unReceivePrincipal = BidConst.ZERO; // 账户待收本金
private BigDecimal unReturnAmount = BidConst.ZERO; // 账户待还金额
private BigDecimal remainBorrowLimit = BidConst.ZERO; // 账户剩余授信额度
private BigDecimal borrowLimitAmount; // 授信额度当前还可以信用借款额度
private static final long serialVersionUID = 6760287512112252557L;
private int version;
private String tradePassword; // 交易密码
private BigDecimal usableAmount = BidConst.ZERO; // 可用余额
private BigDecimal freezedAmount = BidConst.ZERO; // 冻结金额
private BigDecimal unReceiveInterest = BidConst.ZERO; // 账户待收利息
private BigDecimal unReceivePrincipal = BidConst.ZERO; // 账户待收本金
private BigDecimal unReturnAmount = BidConst.ZERO; // 账户待还金额
private BigDecimal remainBorrowLimit = BidConst.ZERO; // 账户剩余授信额度
private BigDecimal borrowLimitAmount; // 授信额度当前还可以信用借款额度
private String abstractInfo;//摘要信息用于防篡改检查;
private String abstractInfo;//摘要信息用于防篡改检查;
public String getAbstractInfo() {//可用余额 + 冻结金额 + 账户神域的授权额度
return MD5Utils.MD5(usableAmount.add(freezedAmount)
.add(remainBorrowLimit).toString());
}
public static Account empty(Long id) {
Account account = new Account();
account.setId(id);
account.setBorrowLimitAmount(BidConst.DEFALUT_BORROWLIMITAMOUNT);
account.setRemainBorrowLimit(BidConst.DEFALUT_BORROWLIMITAMOUNT);
return account;
}
public boolean checkAbstractInfo() {//可用余额 + 冻结金额 + 账户神域的授权额度
return MD5Utils.MD5(
usableAmount.add(freezedAmount).add(remainBorrowLimit)
.toString()).equals(abstractInfo);
}
public String getAbstractInfo() {//可用余额 + 冻结金额 + 账户神域的授权额度
return MD5Utils.MD5(usableAmount.add(freezedAmount)
.add(remainBorrowLimit).toString());
}
public BigDecimal getTotalAmount() {
return usableAmount.add(freezedAmount).add(unReceivePrincipal);
}
public boolean checkAbstractInfo() {//可用余额 + 冻结金额 + 账户神域的授权额度
return MD5Utils.MD5(
usableAmount.add(freezedAmount).add(remainBorrowLimit)
.toString()).equals(abstractInfo);
}
public void addUseableAmount(BigDecimal amount) {
this.usableAmount = this.usableAmount.add(amount);
}
public BigDecimal getTotalAmount() {
return usableAmount.add(freezedAmount).add(unReceivePrincipal);
}
public void addFreezedAmount(BigDecimal amount) {
this.freezedAmount = this.freezedAmount.add(amount);
}
public void addUseableAmount(BigDecimal amount) {
this.usableAmount = this.usableAmount.add(amount);
}
public static Account empty(Long id) {
Account account = new Account();
account.setId(id);
account.setBorrowLimitAmount(BidConst.DEFALUT_BORROWLIMITAMOUNT);
account.setRemainBorrowLimit(BidConst.DEFALUT_BORROWLIMITAMOUNT);
return account;
}
public void addFreezedAmount(BigDecimal amount) {
this.freezedAmount = this.freezedAmount.add(amount);
}
}

View File

@ -12,6 +12,6 @@ import java.io.Serializable;
@Setter
public class BaseDomain implements Serializable {
protected Long id;
protected Long id;
}

View File

@ -8,39 +8,40 @@ import java.util.Date;
/**
* 登陆日志
*
* @author Administrator
*/
@Getter
@Setter
@Alias("IpLog")
public class IpLog extends BaseDomain {
public static int LOGINSTATE_FAILD = 0;//登陆失败
public static int LOGINSTATE_SUCCESS = 1;//登陆成功
public static int LOGINSTATE_FAILD = 0;//登陆失败
public static int LOGINSTATE_SUCCESS = 1;//登陆成功
private String username;
private Date loginTime;
private String ip;
private String username;
private Date loginTime;
private String ip;
private int loginState;
private int loginType;
private Long loginInfoId;
public String getDisplayState(){
return this.loginState==LOGINSTATE_FAILD?"登录失败":"登录成功";
}
private int loginState;
private int loginType;
private Long loginInfoId;
public IpLog() {
super();
}
public IpLog() {
super();
}
public IpLog(String username, Date loginTime, String ip, int loginType,
Long loginInfoId) {
super();
this.username = username;
this.loginTime = loginTime;
this.ip = ip;
this.loginState = IpLog.LOGINSTATE_FAILD;
this.loginType = loginType;
this.loginInfoId = loginInfoId;
}
public IpLog(String username, Date loginTime, String ip, int loginType,
Long loginInfoId) {
super();
this.username = username;
this.loginTime = loginTime;
this.ip = ip;
this.loginState = IpLog.LOGINSTATE_FAILD;
this.loginType = loginType;
this.loginInfoId = loginInfoId;
}
public String getDisplayState() {
return this.loginState == LOGINSTATE_FAILD ? "登录失败" : "登录成功";
}
}

View File

@ -15,13 +15,13 @@ import java.util.Date;
@NoArgsConstructor
public class Logininfo implements Serializable {
private Long id;
private String nickname;
private String password;
private String salt;
private Date registerDate;
private Date lastLoginDate;
private int state = Constants.STATE_NORMAL;
private int userType;//用户类型
private boolean admin = false;
private Long id;
private String nickname;
private String password;
private String salt;
private Date registerDate;
private Date lastLoginDate;
private int state = Constants.STATE_NORMAL;
private int userType;//用户类型
private boolean admin = false;
}

View File

@ -10,25 +10,24 @@ import java.util.Map;
/**
* 数据字典
*
*
* @author Stef
*
*/
@Getter
@Setter
@Alias("SystemDictionary")
public class SystemDictionary extends BaseDomain {
private static final long serialVersionUID = 3382007784095246946L;
private String sn; // 编码
private String title; // 名称
private String intro; // 简介
private static final long serialVersionUID = 3382007784095246946L;
private String sn; // 编码
private String title; // 名称
private String intro; // 简介
public String getJsonString() {
Map<String, Object> m = new HashMap<>();
m.put("id", getId());
m.put("sn", sn);
m.put("title", title);
m.put("intro", intro);
return JSONObject.toJSONString(m);
}
public String getJsonString() {
Map<String, Object> m = new HashMap<>();
m.put("id", getId());
m.put("sn", sn);
m.put("title", title);
m.put("intro", intro);
return JSONObject.toJSONString(m);
}
}

View File

@ -10,7 +10,7 @@ import java.util.Map;
/**
* 数据字典明细
*
*
* @author Stef
*/
@Getter
@ -18,21 +18,21 @@ import java.util.Map;
@Alias("SystemDictionaryItem")
public class SystemDictionaryItem extends BaseDomain {
private static final long serialVersionUID = 4520006109163647891L;
private Long parentId; // 系统目录
private String title; // 名称
private String tvalue; //
private Integer sequence; // 序列
private String intro; // 说明
private static final long serialVersionUID = 4520006109163647891L;
private Long parentId; // 系统目录
private String title; // 名称
private String tvalue; //
private Integer sequence; // 序列
private String intro; // 说明
public String getJsonString() {
Map<String, Object> m = new HashMap<>();
m.put("id", getId());
m.put("parentId", parentId);
m.put("title", title);
m.put("tvalue", tvalue);
m.put("sequence", sequence);
m.put("intro", intro);
return JSONObject.toJSONString(m);
}
public String getJsonString() {
Map<String, Object> m = new HashMap<>();
m.put("id", getId());
m.put("parentId", parentId);
m.put("title", title);
m.put("tvalue", tvalue);
m.put("sequence", sequence);
m.put("intro", intro);
return JSONObject.toJSONString(m);
}
}

View File

@ -36,7 +36,7 @@ public class Userinfo extends BaseDomain {
*/
private String email;
/**
* 手机号
* 手机号
*/
private String phoneNumber = "";
/**
@ -54,7 +54,7 @@ public class Userinfo extends BaseDomain {
*/
private SystemDictionaryItem incomeGrade;
/**
* 婚姻情况
* 婚姻情况
*/
private SystemDictionaryItem marriage;
/**
@ -72,68 +72,15 @@ public class Userinfo extends BaseDomain {
public static Userinfo empty(Long id) {
Userinfo userinfo = new Userinfo();
userinfo.setId(id);
userinfo.setBitState(BitStatesUtils.OP_BASIC_INFO);
userinfo.setId(id);
userinfo.setBitState(BitStatesUtils.OP_BASIC_INFO);
return userinfo;
}
public void addState(Long state) {
this.bitState = BitStatesUtils.addState(this.bitState, state);
}
public void removeState(Long state) {
this.bitState = BitStatesUtils.removeState(this.bitState, state);
}
public boolean getIsBindPhone() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_PHONE);
}
public boolean getIsBindEmail() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_EMAIL);
}
public boolean getBaseInfo() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BASE_INFO);
}
public boolean getRealAuth() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_REAL_AUTH);
}
public boolean getVedioAuth() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_VEDIO_AUTH);
}
public boolean getHasBidRequest(){
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_HAS_BIDRQUEST);
}
/**
* 获取用户真实名字的隐藏字符串只显示姓氏
*
* @param 真实名字
* @return
*/
public String getAnonymousRealName() {
if (StringUtils.hasLength(realName)) {
int len = realName.length();
String replace = "";
replace += realName.charAt(0);
for (int i = 1; i < len; i++) {
replace += "*";
}
return replace;
}
return realName;
}
/**
* 获取用户真实名字的隐藏字符串只显示姓氏
*
* @param realName
* 真实名字
* @param realName 真实名字
* @return
*/
public static String getAnonymousRealName(String realName) {
@ -171,12 +118,10 @@ public class Userinfo extends BaseDomain {
return idNumber;
}
/**
* 获取用户手机号码的隐藏字符串
*
* @param phoneNumber
* 用户手机号码
* @param phoneNumber 用户手机号码
* @return
*/
public static String getAnonymousPhoneNumber(String phoneNumber) {
@ -198,8 +143,7 @@ public class Userinfo extends BaseDomain {
/**
* 获取用户住址的隐藏字符串
*
* @param currentAddress
* 用户住址
* @param currentAddress 用户住址
* @return
*/
public static String getAnonymousCurrentAddress(String currentAddress) {
@ -215,4 +159,56 @@ public class Userinfo extends BaseDomain {
}
return currentAddress;
}
public void addState(Long state) {
this.bitState = BitStatesUtils.addState(this.bitState, state);
}
public void removeState(Long state) {
this.bitState = BitStatesUtils.removeState(this.bitState, state);
}
public boolean getIsBindPhone() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_PHONE);
}
public boolean getIsBindEmail() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_EMAIL);
}
public boolean getBaseInfo() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BASE_INFO);
}
public boolean getRealAuth() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_REAL_AUTH);
}
public boolean getVedioAuth() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_VEDIO_AUTH);
}
public boolean getHasBidRequest() {
return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_HAS_BIDRQUEST);
}
/**
* 获取用户真实名字的隐藏字符串只显示姓氏
*
* @param 真实名字
* @return
*/
public String getAnonymousRealName() {
if (StringUtils.hasLength(realName)) {
int len = realName.length();
String replace = "";
replace += realName.charAt(0);
for (int i = 1; i < len; i++) {
replace += "*";
}
return replace;
}
return realName;
}
}

View File

@ -14,22 +14,22 @@ public class OrdersExample {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public boolean isDistinct() {
return distinct;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
@ -339,38 +339,6 @@ public class OrdersExample {
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
@ -406,5 +374,37 @@ public class OrdersExample {
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
}
}

View File

@ -9,35 +9,35 @@ import java.util.Date;
/**
* IpLog查询对象
* @author 邱润泽
*
* @author 邱润泽
*/
@Setter
@Getter
public class IpLogQueryObject extends QueryObject {
private Date beginDate;
private Date endDate;
private String username;
private int userType=-1;
private boolean like;
private int state=-1;
private Date beginDate;
private Date endDate;
private String username;
private int userType = -1;
private boolean like;
private int state = -1;
@DateTimeFormat(pattern = "yyyy-MM-dd")
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
@DateTimeFormat(pattern = "yyyy-MM-dd")
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
@DateTimeFormat(pattern = "yyyy-MM-dd")
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getEndDate() {
if (endDate != null) {
return DateUtil.endOfDay(endDate);
}
return null;
}
public Date getEndDate() {
if (endDate != null) {
return DateUtil.endOfDay(endDate);
}
return null;
}
@DateTimeFormat(pattern = "yyyy-MM-dd")
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}

View File

@ -5,62 +5,62 @@ import java.util.List;
public class PageResult {
private Integer totalCount;
private Integer pageSize = 10;
private Integer currentPage = 1;
private List result;
private Integer totalCount;
private Integer pageSize = 10;
private Integer currentPage = 1;
private List result;
public PageResult() {
public PageResult() {
}
}
public static PageResult empty(int pageSize) {
return new PageResult(0, pageSize, 1, new ArrayList());
}
public PageResult(Integer totalCount, Integer pageSize,
Integer currentPage, List result) {
super();
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currentPage = currentPage;
this.result = result;
}
public PageResult(Integer totalCount, Integer pageSize,
Integer currentPage, List result) {
super();
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currentPage = currentPage;
this.result = result;
}
public static PageResult empty(int pageSize) {
return new PageResult(0, pageSize, 1, new ArrayList());
}
public Integer getTotalPage() {
return Math.max((totalCount + pageSize - 1) / pageSize, 1);
}
public Integer getTotalPage() {
return Math.max((totalCount + pageSize - 1) / pageSize, 1);
}
public Integer getPrev() {
return Math.max(currentPage - 1, 1);
}
public Integer getPrev() {
return Math.max(currentPage - 1, 1);
}
public Integer getNext() {
return Math.min(currentPage + 1, getTotalPage());
}
public Integer getNext() {
return Math.min(currentPage + 1, getTotalPage());
}
public Integer getTotalCount() {
return totalCount;
}
public Integer getTotalCount() {
return totalCount;
}
public List getResult() {
return result;
}
public List getResult() {
return result;
}
public Integer getCurrentPage() {
return currentPage;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getPageSize() {
return pageSize;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -8,11 +8,11 @@ import lombok.Setter;
@Setter
public class QueryObject {
private Integer currentPage = 1;
private Integer pageSize = 10;
private Integer currentPage = 1;
private Integer pageSize = 10;
public int getStart() {
return (currentPage - 1) * pageSize;
}
public int getStart() {
return (currentPage - 1) * pageSize;
}
}

View File

@ -7,10 +7,10 @@ import org.springframework.util.StringUtils;
@Getter
@Setter
public class SystemDictionaryQueryObject extends QueryObject {
private String keyword;
private Long parentId;
private String keyword;
private Long parentId;
public String getKeyword() {
return StringUtils.hasLength(keyword) ? keyword : null;
}
public String getKeyword() {
return StringUtils.hasLength(keyword) ? keyword : null;
}
}

View File

@ -7,11 +7,11 @@ import java.util.List;
public interface IAccountService {
void update(Account account);
void update(Account account);
Account get(Long id);
void recreateAbstractInfo();
List<Account> listAll();
Account get(Long id);
void recreateAbstractInfo();
List<Account> listAll();
}

View File

@ -5,44 +5,49 @@ import com.geekq.common.utils.resultbean.ResultGeekQ;
import java.util.List;
import java.util.Map;
public interface ILogininfoService {
/**
* 注册
* @param username
* @param password
*/
void register(String username, String password);
/**
* 注册
*
* @param username
* @param password
*/
void register(String username, String password);
/**
* 检查是否有重复的用户名
*/
boolean checkUsername(String name, int userType);
/**
* 检查是否有重复的用户名
*/
boolean checkUsername(String name, int userType);
/**
* 用户登陆
* @param name
* @param password
* @return
*/
ResultGeekQ<Logininfo> login(String name, String password, int userType, String ip);
/**
* 用户登陆
*
* @param name
* @param password
* @return
*/
ResultGeekQ<Logininfo> login(String name, String password, int userType, String ip);
/**
* 是否有管理员
* @return
*/
boolean hasAdmin();
/**
* 是否有管理员
*
* @return
*/
boolean hasAdmin();
/**
* 创建默认的管理员
*/
void createDefaultAdmin();
/**
* 创建默认的管理员
*/
void createDefaultAdmin();
/**
* 查询用户的id和name
* @param word
* @param userType
* @return
*/
List<Map<String, Object>> autoComplate(String word, int userType);
/**
* 查询用户的id和name
*
* @param word
* @param userType
* @return
*/
List<Map<String, Object>> autoComplate(String word, int userType);
}

View File

@ -9,16 +9,16 @@ import java.util.List;
public interface ISystemDictionaryService {
PageResult queryDic(SystemDictionaryQueryObject qo);
PageResult queryDic(SystemDictionaryQueryObject qo);
void saveOrUpdate(SystemDictionary sd);
void saveOrUpdate(SystemDictionary sd);
PageResult queryDicItem(SystemDictionaryQueryObject qo);
PageResult queryDicItem(SystemDictionaryQueryObject qo);
void saveOrUpdateItem(SystemDictionaryItem item);
void saveOrUpdateItem(SystemDictionaryItem item);
List<SystemDictionary> listDics();
List<SystemDictionaryItem> queryBySn(String sn);
List<SystemDictionary> listDics();
List<SystemDictionaryItem> queryBySn(String sn);
}

View File

@ -5,15 +5,16 @@ import com.geekq.admin.entity.Userinfo;
public interface IUserService {
void update(Userinfo userinfo);
void update(Userinfo userinfo);
Userinfo get(Long id);
Userinfo get(Long id);
boolean bindPhone(String phoneNumber, String verifyCode);
boolean bindPhone(String phoneNumber, String verifyCode);
/**
* 修改基本信息
* @param userinfo
*/
void updateBasicInfo(Userinfo userinfo);
/**
* 修改基本信息
*
* @param userinfo
*/
void updateBasicInfo(Userinfo userinfo);
}

View File

@ -4,15 +4,15 @@ import com.geekq.admin.pojo.Orders;
public interface OrdersService {
/**
* @Description: 根据订单id查询订单
*/
public Orders getOrder(String orderId);
/**
* @Description: 下订单
*/
public boolean createOrder(String itemId);
/**
* @Description: 根据订单id查询订单
*/
public Orders getOrder(String orderId);
/**
* @Description: 下订单
*/
public boolean createOrder(String itemId);
}

View File

@ -2,8 +2,6 @@ package com.geekq.admin.service;
import com.geekq.admin.entity.Logininfo;
import java.util.Map;
public interface RedisCacheStorageService<K, V> {
/**
@ -16,6 +14,5 @@ public interface RedisCacheStorageService<K, V> {
boolean set(String key, V value);
Logininfo get(String key);
}

View File

@ -13,46 +13,19 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</dependency>
<!-- Jackson Json处理工具包 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- 校验处理工具包 -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>7.0.1.Final</version>
</dependency>
<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
@ -61,5 +34,9 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -4,7 +4,7 @@ package com.geekq.common.enums;
* @author 邱润泽
* 常用数据静态变量类型集合
*/
public class Constants {
public class Constants {
public static final int STATE_NORMAL = 0;
public static final int STATE_LOCK = 1;

View File

@ -2,17 +2,18 @@ package com.geekq.common.enums;
public class MessageStatus {
public static final Integer ZORE = 0;
public static final Integer ZORE = 0;
/**
* 消息类型
*/
public enum messageType {
public enum messageType {
maiosha_message("秒杀消息"),
buy_message("购买消息"),
system_message("系统消息");
private String message;
private messageType(String message){
private messageType(String message) {
this.message = message;
}
@ -24,10 +25,10 @@ public class MessageStatus {
/**
* 消息内容
*/
public enum ContentEnum {
system_message_register(7000,"尊敬的用户你好,你已经成功注册!"),
public enum ContentEnum {
system_message_register(7000, "尊敬的用户你好,你已经成功注册!"),
system_message_register_head(7001,"注册成功");
system_message_register_head(7001, "注册成功");
private int code;
private String message;
@ -45,10 +46,11 @@ public class MessageStatus {
return message;
}
}
/**
* 消息类型
*/
public enum sendType {
public enum sendType {
// maiosha_message("秒杀消息"),
// buy_message("购买消息"),
// system_message("系统消息");

View File

@ -1,40 +1,39 @@
package com.geekq.common.enums;
/**
*
* @Description: 订单状态
*/
public enum OrderStatusEnum {
WAIT_PAY(10, "待付款"), // 代付款
PAYING(20, "付款中"), // 付款中
PAID(30, "已付款"), // 已付款
PAID_FAILD(40, "付款失败"), // 付款失败
CANCELED(50, "已取消"), // 已取消
CLOSED(60, "交易关闭"); // 超时未支付, 交易关闭
public final int key;
public final String value;
OrderStatusEnum(int key, String value) {
this.key = key;
this.value = value;
}
WAIT_PAY(10, "待付款"), // 代付款
PAYING(20, "付款中"), // 付款中
PAID(30, "已付款"), // 已付款
PAID_FAILD(40, "付款失败"), // 付款失败
CANCELED(50, "已取消"), // 已取消
CLOSED(60, "交易关闭"); // 超时未支付, 交易关闭
public static String getName(int key) {
for (OrderStatusEnum status : OrderStatusEnum.values()) {
if (status.getKey() == key) {
return status.value;
}
}
return null;
}
public int getKey() {
return key;
}
public final int key;
public final String value;
public String getValue() {
return value;
}
OrderStatusEnum(int key, String value) {
this.key = key;
this.value = value;
}
public static String getName(int key) {
for (OrderStatusEnum status : OrderStatusEnum.values()) {
if (status.getKey() == key) {
return status.value;
}
}
return null;
}
public int getKey() {
return key;
}
public String getValue() {
return value;
}
}

View File

@ -8,6 +8,7 @@ package com.geekq.common.enums;
* 4 秒杀错误
* 5 商品错误
* 6 订单错误
*
* @author qiurunze
*/
public enum ResultStatus {
@ -28,38 +29,38 @@ public enum ResultStatus {
/**
* 注册登录
*/
RESIGETR_SUCCESS(20000,"注册成功!"),
RESIGETER_FAIL(200001,"注册失败!"),
CODE_FAIL(200002,"验证码不一致!"),
RESIGETER_NICKNAMEEXIST(200003,"用户名已经存在!"),
LOGIN_FIAL(200004,"登录失败!"),
RESIGETR_SUCCESS(20000, "注册成功!"),
RESIGETER_FAIL(200001, "注册失败!"),
CODE_FAIL(200002, "验证码不一致!"),
RESIGETER_NICKNAMEEXIST(200003, "用户名已经存在!"),
LOGIN_FIAL(200004, "登录失败!"),
/**
* check
*/
BIND_ERROR (30001,"参数校验异常:%s"),
ACCESS_LIMIT_REACHED (30002,"请求非法!"),
REQUEST_ILLEGAL (30004,"访问太频繁!"),
SESSION_ERROR (30005,"Session不存在或者已经失效!"),
PASSWORD_EMPTY (30006,"登录密码不能为空!"),
MOBILE_EMPTY (30007,"手机号不能为空!"),
MOBILE_ERROR (30008,"手机号格式错误!"),
MOBILE_NOT_EXIST (30009,"手机号不存在!"),
PASSWORD_ERROR (30010,"密码错误!"),
USER_NOT_EXIST(30011,"用户不存在!"),
BIND_ERROR(30001, "参数校验异常:%s"),
ACCESS_LIMIT_REACHED(30002, "请求非法!"),
REQUEST_ILLEGAL(30004, "访问太频繁!"),
SESSION_ERROR(30005, "Session不存在或者已经失效!"),
PASSWORD_EMPTY(30006, "登录密码不能为空!"),
MOBILE_EMPTY(30007, "手机号不能为空!"),
MOBILE_ERROR(30008, "手机号格式错误!"),
MOBILE_NOT_EXIST(30009, "手机号不存在!"),
PASSWORD_ERROR(30010, "密码错误!"),
USER_NOT_EXIST(30011, "用户不存在!"),
/**
* 订单模块
*/
ORDER_NOT_EXIST(60001,"订单不存在"),
ORDER_NOT_EXIST(60001, "订单不存在"),
/**
* 秒杀模块
*/
MIAO_SHA_OVER(40001,"商品已经秒杀完毕"),
REPEATE_MIAOSHA(40002,"不能重复秒杀"),
MIAOSHA_FAIL(40003,"秒杀失败");
MIAO_SHA_OVER(40001, "商品已经秒杀完毕"),
REPEATE_MIAOSHA(40002, "不能重复秒杀"),
MIAOSHA_FAIL(40003, "秒杀失败");
/**
* 商品模块
@ -72,6 +73,10 @@ public enum ResultStatus {
this.message = message;
}
private ResultStatus(Object... args) {
this.message = String.format(this.message, args);
}
public int getCode() {
return this.code;