diff --git a/mall-dao/src/main/java/com/buy507/mall/model/MemberLevel.java b/mall-dao/src/main/java/com/buy507/mall/model/MemberLevel.java index be4f0d4..060d8b8 100644 --- a/mall-dao/src/main/java/com/buy507/mall/model/MemberLevel.java +++ b/mall-dao/src/main/java/com/buy507/mall/model/MemberLevel.java @@ -7,11 +7,11 @@ package com.buy507.mall.model; */ public enum MemberLevel { - Member(0), //普通会员 - Consumer(1), //消费商 - Partner(2), //经销商 - Diamond(3), //合作商 - OneDiamond(4), //初级合作商 + Member(0), //普通用户 + Consumer(1), //vip会员 + Partner(2), //店长 + Diamond(3), //代理 + OneDiamond(4), //总监 TwoDiamond(5), //中级合作商 ThreeDiamond(6), //高级合作商 FourDiamond(7); //特级合作商 diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransaction.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransaction.java new file mode 100644 index 0000000..298d002 --- /dev/null +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransaction.java @@ -0,0 +1,105 @@ +package com.buy507.mall.model; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +public class UmsMemberAccountTransaction implements Serializable { + @ApiModelProperty(value = "主键id") + private Long id; + + @ApiModelProperty(value = "会员id") + private Long memberId; + + @ApiModelProperty(value = "订单id") + private Long orderId; + + @ApiModelProperty(value = "进帐金额") + private BigDecimal revenueAmount; + + @ApiModelProperty(value = "备注") + private String remarks; + + @ApiModelProperty(value = "提成比例") + private Integer commissionRatio; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getMemberId() { + return memberId; + } + + public void setMemberId(Long memberId) { + this.memberId = memberId; + } + + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + + public BigDecimal getRevenueAmount() { + return revenueAmount; + } + + public void setRevenueAmount(BigDecimal revenueAmount) { + this.revenueAmount = revenueAmount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getCommissionRatio() { + return commissionRatio; + } + + public void setCommissionRatio(Integer commissionRatio) { + this.commissionRatio = commissionRatio; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", memberId=").append(memberId); + sb.append(", orderId=").append(orderId); + sb.append(", revenueAmount=").append(revenueAmount); + sb.append(", remarks=").append(remarks); + sb.append(", commissionRatio=").append(commissionRatio); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransactionExample.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransactionExample.java new file mode 100644 index 0000000..5d18f1a --- /dev/null +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberAccountTransactionExample.java @@ -0,0 +1,632 @@ +package com.buy507.mall.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class UmsMemberAccountTransactionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UmsMemberAccountTransactionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andMemberIdIsNull() { + addCriterion("member_id is null"); + return (Criteria) this; + } + + public Criteria andMemberIdIsNotNull() { + addCriterion("member_id is not null"); + return (Criteria) this; + } + + public Criteria andMemberIdEqualTo(Long value) { + addCriterion("member_id =", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotEqualTo(Long value) { + addCriterion("member_id <>", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThan(Long value) { + addCriterion("member_id >", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThanOrEqualTo(Long value) { + addCriterion("member_id >=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThan(Long value) { + addCriterion("member_id <", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThanOrEqualTo(Long value) { + addCriterion("member_id <=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdIn(List values) { + addCriterion("member_id in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotIn(List values) { + addCriterion("member_id not in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdBetween(Long value1, Long value2) { + addCriterion("member_id between", value1, value2, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotBetween(Long value1, Long value2) { + addCriterion("member_id not between", value1, value2, "memberId"); + return (Criteria) this; + } + + public Criteria andOrderIdIsNull() { + addCriterion("order_id is null"); + return (Criteria) this; + } + + public Criteria andOrderIdIsNotNull() { + addCriterion("order_id is not null"); + return (Criteria) this; + } + + public Criteria andOrderIdEqualTo(Long value) { + addCriterion("order_id =", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotEqualTo(Long value) { + addCriterion("order_id <>", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdGreaterThan(Long value) { + addCriterion("order_id >", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdGreaterThanOrEqualTo(Long value) { + addCriterion("order_id >=", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdLessThan(Long value) { + addCriterion("order_id <", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdLessThanOrEqualTo(Long value) { + addCriterion("order_id <=", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdIn(List values) { + addCriterion("order_id in", values, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotIn(List values) { + addCriterion("order_id not in", values, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdBetween(Long value1, Long value2) { + addCriterion("order_id between", value1, value2, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotBetween(Long value1, Long value2) { + addCriterion("order_id not between", value1, value2, "orderId"); + return (Criteria) this; + } + + public Criteria andRevenueAmountIsNull() { + addCriterion("revenue_amount is null"); + return (Criteria) this; + } + + public Criteria andRevenueAmountIsNotNull() { + addCriterion("revenue_amount is not null"); + return (Criteria) this; + } + + public Criteria andRevenueAmountEqualTo(BigDecimal value) { + addCriterion("revenue_amount =", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountNotEqualTo(BigDecimal value) { + addCriterion("revenue_amount <>", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountGreaterThan(BigDecimal value) { + addCriterion("revenue_amount >", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("revenue_amount >=", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountLessThan(BigDecimal value) { + addCriterion("revenue_amount <", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountLessThanOrEqualTo(BigDecimal value) { + addCriterion("revenue_amount <=", value, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountIn(List values) { + addCriterion("revenue_amount in", values, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountNotIn(List values) { + addCriterion("revenue_amount not in", values, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("revenue_amount between", value1, value2, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRevenueAmountNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("revenue_amount not between", value1, value2, "revenueAmount"); + return (Criteria) this; + } + + public Criteria andRemarksIsNull() { + addCriterion("remarks is null"); + return (Criteria) this; + } + + public Criteria andRemarksIsNotNull() { + addCriterion("remarks is not null"); + return (Criteria) this; + } + + public Criteria andRemarksEqualTo(String value) { + addCriterion("remarks =", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotEqualTo(String value) { + addCriterion("remarks <>", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThan(String value) { + addCriterion("remarks >", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksGreaterThanOrEqualTo(String value) { + addCriterion("remarks >=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThan(String value) { + addCriterion("remarks <", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLessThanOrEqualTo(String value) { + addCriterion("remarks <=", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksLike(String value) { + addCriterion("remarks like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotLike(String value) { + addCriterion("remarks not like", value, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksIn(List values) { + addCriterion("remarks in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotIn(List values) { + addCriterion("remarks not in", values, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksBetween(String value1, String value2) { + addCriterion("remarks between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andRemarksNotBetween(String value1, String value2) { + addCriterion("remarks not between", value1, value2, "remarks"); + return (Criteria) this; + } + + public Criteria andCommissionRatioIsNull() { + addCriterion("commission_ratio is null"); + return (Criteria) this; + } + + public Criteria andCommissionRatioIsNotNull() { + addCriterion("commission_ratio is not null"); + return (Criteria) this; + } + + public Criteria andCommissionRatioEqualTo(Integer value) { + addCriterion("commission_ratio =", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotEqualTo(Integer value) { + addCriterion("commission_ratio <>", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioGreaterThan(Integer value) { + addCriterion("commission_ratio >", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioGreaterThanOrEqualTo(Integer value) { + addCriterion("commission_ratio >=", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioLessThan(Integer value) { + addCriterion("commission_ratio <", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioLessThanOrEqualTo(Integer value) { + addCriterion("commission_ratio <=", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioIn(List values) { + addCriterion("commission_ratio in", values, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotIn(List values) { + addCriterion("commission_ratio not in", values, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioBetween(Integer value1, Integer value2) { + addCriterion("commission_ratio between", value1, value2, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotBetween(Integer value1, Integer value2) { + addCriterion("commission_ratio not between", value1, value2, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + 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; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevel.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevel.java index 656c66f..1e397af 100644 --- a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevel.java +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevel.java @@ -5,10 +5,13 @@ import java.io.Serializable; import java.math.BigDecimal; public class UmsMemberLevel implements Serializable { + @ApiModelProperty(value = "主键id") private Long id; + @ApiModelProperty(value = "会员名称") private String name; + @ApiModelProperty(value = "会员等级升级点") private Integer growthPoint; @ApiModelProperty(value = "是否为默认等级:0->不是;1->是") @@ -38,8 +41,12 @@ public class UmsMemberLevel implements Serializable { @ApiModelProperty(value = "是否有生日特权") private Integer priviledgeBirthday; + @ApiModelProperty(value = "注释") private String note; + @ApiModelProperty(value = "提成比例") + private Integer commissionRatio; + private static final long serialVersionUID = 1L; public Long getId() { @@ -146,6 +153,14 @@ public class UmsMemberLevel implements Serializable { this.note = note; } + public Integer getCommissionRatio() { + return commissionRatio; + } + + public void setCommissionRatio(Integer commissionRatio) { + this.commissionRatio = commissionRatio; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -165,6 +180,7 @@ public class UmsMemberLevel implements Serializable { sb.append(", priviledgeMemberPrice=").append(priviledgeMemberPrice); sb.append(", priviledgeBirthday=").append(priviledgeBirthday); sb.append(", note=").append(note); + sb.append(", commissionRatio=").append(commissionRatio); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevelExample.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevelExample.java index 9906ac1..33b9dcf 100644 --- a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevelExample.java +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberLevelExample.java @@ -904,6 +904,66 @@ public class UmsMemberLevelExample { addCriterion("note not between", value1, value2, "note"); return (Criteria) this; } + + public Criteria andCommissionRatioIsNull() { + addCriterion("commission_ratio is null"); + return (Criteria) this; + } + + public Criteria andCommissionRatioIsNotNull() { + addCriterion("commission_ratio is not null"); + return (Criteria) this; + } + + public Criteria andCommissionRatioEqualTo(Integer value) { + addCriterion("commission_ratio =", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotEqualTo(Integer value) { + addCriterion("commission_ratio <>", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioGreaterThan(Integer value) { + addCriterion("commission_ratio >", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioGreaterThanOrEqualTo(Integer value) { + addCriterion("commission_ratio >=", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioLessThan(Integer value) { + addCriterion("commission_ratio <", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioLessThanOrEqualTo(Integer value) { + addCriterion("commission_ratio <=", value, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioIn(List values) { + addCriterion("commission_ratio in", values, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotIn(List values) { + addCriterion("commission_ratio not in", values, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioBetween(Integer value1, Integer value2) { + addCriterion("commission_ratio between", value1, value2, "commissionRatio"); + return (Criteria) this; + } + + public Criteria andCommissionRatioNotBetween(Integer value1, Integer value2) { + addCriterion("commission_ratio not between", value1, value2, "commissionRatio"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTree.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTree.java new file mode 100644 index 0000000..15fa51a --- /dev/null +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTree.java @@ -0,0 +1,80 @@ +package com.buy507.mall.model; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.Date; + +public class UmsMemberRelationTree implements Serializable { + @ApiModelProperty(value = "主键id") + private Long id; + + @ApiModelProperty(value = "会员id") + private Long memberId; + + @ApiModelProperty(value = "上级会员id") + private Integer higherLevelId; + + @ApiModelProperty(value = "0 未退出,1 退出队列") + private Integer quitQueueMark; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getMemberId() { + return memberId; + } + + public void setMemberId(Long memberId) { + this.memberId = memberId; + } + + public Integer getHigherLevelId() { + return higherLevelId; + } + + public void setHigherLevelId(Integer higherLevelId) { + this.higherLevelId = higherLevelId; + } + + public Integer getQuitQueueMark() { + return quitQueueMark; + } + + public void setQuitQueueMark(Integer quitQueueMark) { + this.quitQueueMark = quitQueueMark; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", memberId=").append(memberId); + sb.append(", higherLevelId=").append(higherLevelId); + sb.append(", quitQueueMark=").append(quitQueueMark); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTreeExample.java b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTreeExample.java new file mode 100644 index 0000000..372a344 --- /dev/null +++ b/mall-dao/src/main/java/com/buy507/mall/model/UmsMemberRelationTreeExample.java @@ -0,0 +1,501 @@ +package com.buy507.mall.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class UmsMemberRelationTreeExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UmsMemberRelationTreeExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andMemberIdIsNull() { + addCriterion("member_id is null"); + return (Criteria) this; + } + + public Criteria andMemberIdIsNotNull() { + addCriterion("member_id is not null"); + return (Criteria) this; + } + + public Criteria andMemberIdEqualTo(Long value) { + addCriterion("member_id =", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotEqualTo(Long value) { + addCriterion("member_id <>", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThan(Long value) { + addCriterion("member_id >", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThanOrEqualTo(Long value) { + addCriterion("member_id >=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThan(Long value) { + addCriterion("member_id <", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThanOrEqualTo(Long value) { + addCriterion("member_id <=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdIn(List values) { + addCriterion("member_id in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotIn(List values) { + addCriterion("member_id not in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdBetween(Long value1, Long value2) { + addCriterion("member_id between", value1, value2, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotBetween(Long value1, Long value2) { + addCriterion("member_id not between", value1, value2, "memberId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdIsNull() { + addCriterion("higher_level_id is null"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdIsNotNull() { + addCriterion("higher_level_id is not null"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdEqualTo(Integer value) { + addCriterion("higher_level_id =", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdNotEqualTo(Integer value) { + addCriterion("higher_level_id <>", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdGreaterThan(Integer value) { + addCriterion("higher_level_id >", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdGreaterThanOrEqualTo(Integer value) { + addCriterion("higher_level_id >=", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdLessThan(Integer value) { + addCriterion("higher_level_id <", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdLessThanOrEqualTo(Integer value) { + addCriterion("higher_level_id <=", value, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdIn(List values) { + addCriterion("higher_level_id in", values, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdNotIn(List values) { + addCriterion("higher_level_id not in", values, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdBetween(Integer value1, Integer value2) { + addCriterion("higher_level_id between", value1, value2, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andHigherLevelIdNotBetween(Integer value1, Integer value2) { + addCriterion("higher_level_id not between", value1, value2, "higherLevelId"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkIsNull() { + addCriterion("quit_queue_mark is null"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkIsNotNull() { + addCriterion("quit_queue_mark is not null"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkEqualTo(Integer value) { + addCriterion("quit_queue_mark =", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkNotEqualTo(Integer value) { + addCriterion("quit_queue_mark <>", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkGreaterThan(Integer value) { + addCriterion("quit_queue_mark >", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkGreaterThanOrEqualTo(Integer value) { + addCriterion("quit_queue_mark >=", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkLessThan(Integer value) { + addCriterion("quit_queue_mark <", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkLessThanOrEqualTo(Integer value) { + addCriterion("quit_queue_mark <=", value, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkIn(List values) { + addCriterion("quit_queue_mark in", values, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkNotIn(List values) { + addCriterion("quit_queue_mark not in", values, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkBetween(Integer value1, Integer value2) { + addCriterion("quit_queue_mark between", value1, value2, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andQuitQueueMarkNotBetween(Integer value1, Integer value2) { + addCriterion("quit_queue_mark not between", value1, value2, "quitQueueMark"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + 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; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml new file mode 100644 index 0000000..7bc1d4a --- /dev/null +++ b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, member_id, order_id, revenue_amount, remarks, commission_ratio, create_time + + + + + delete from ums_member_account_transaction + where id = #{id,jdbcType=BIGINT} + + + delete from ums_member_account_transaction + + + + + + + SELECT LAST_INSERT_ID() + + insert into ums_member_account_transaction (member_id, order_id, revenue_amount, + remarks, commission_ratio, create_time + ) + values (#{memberId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{revenueAmount,jdbcType=DECIMAL}, + #{remarks,jdbcType=VARCHAR}, #{commissionRatio,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP} + ) + + + + SELECT LAST_INSERT_ID() + + insert into ums_member_account_transaction + + + member_id, + + + order_id, + + + revenue_amount, + + + remarks, + + + commission_ratio, + + + create_time, + + + + + #{memberId,jdbcType=BIGINT}, + + + #{orderId,jdbcType=BIGINT}, + + + #{revenueAmount,jdbcType=DECIMAL}, + + + #{remarks,jdbcType=VARCHAR}, + + + #{commissionRatio,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + update ums_member_account_transaction + + + id = #{record.id,jdbcType=BIGINT}, + + + member_id = #{record.memberId,jdbcType=BIGINT}, + + + order_id = #{record.orderId,jdbcType=BIGINT}, + + + revenue_amount = #{record.revenueAmount,jdbcType=DECIMAL}, + + + remarks = #{record.remarks,jdbcType=VARCHAR}, + + + commission_ratio = #{record.commissionRatio,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + + + + + + update ums_member_account_transaction + set id = #{record.id,jdbcType=BIGINT}, + member_id = #{record.memberId,jdbcType=BIGINT}, + order_id = #{record.orderId,jdbcType=BIGINT}, + revenue_amount = #{record.revenueAmount,jdbcType=DECIMAL}, + remarks = #{record.remarks,jdbcType=VARCHAR}, + commission_ratio = #{record.commissionRatio,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP} + + + + + + update ums_member_account_transaction + + + member_id = #{memberId,jdbcType=BIGINT}, + + + order_id = #{orderId,jdbcType=BIGINT}, + + + revenue_amount = #{revenueAmount,jdbcType=DECIMAL}, + + + remarks = #{remarks,jdbcType=VARCHAR}, + + + commission_ratio = #{commissionRatio,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update ums_member_account_transaction + set member_id = #{memberId,jdbcType=BIGINT}, + order_id = #{orderId,jdbcType=BIGINT}, + revenue_amount = #{revenueAmount,jdbcType=DECIMAL}, + remarks = #{remarks,jdbcType=VARCHAR}, + commission_ratio = #{commissionRatio,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberLevelMapper.xml b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberLevelMapper.xml index 91f7a33..b4b524e 100644 --- a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberLevelMapper.xml +++ b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberLevelMapper.xml @@ -15,6 +15,7 @@ + @@ -77,7 +78,7 @@ id, name, growth_point, default_status, free_freight_point, comment_growth_point, priviledge_free_freight, priviledge_sign_in, priviledge_comment, priviledge_promotion, - priviledge_member_price, priviledge_birthday, note + priviledge_member_price, priviledge_birthday, note, commission_ratio @@ -254,6 +261,9 @@ note = #{record.note,jdbcType=VARCHAR}, + + commission_ratio = #{record.commissionRatio,jdbcType=INTEGER}, + @@ -273,7 +283,8 @@ priviledge_promotion = #{record.priviledgePromotion,jdbcType=INTEGER}, priviledge_member_price = #{record.priviledgeMemberPrice,jdbcType=INTEGER}, priviledge_birthday = #{record.priviledgeBirthday,jdbcType=INTEGER}, - note = #{record.note,jdbcType=VARCHAR} + note = #{record.note,jdbcType=VARCHAR}, + commission_ratio = #{record.commissionRatio,jdbcType=INTEGER} @@ -317,6 +328,9 @@ note = #{note,jdbcType=VARCHAR}, + + commission_ratio = #{commissionRatio,jdbcType=INTEGER}, + where id = #{id,jdbcType=BIGINT} @@ -333,7 +347,8 @@ priviledge_promotion = #{priviledgePromotion,jdbcType=INTEGER}, priviledge_member_price = #{priviledgeMemberPrice,jdbcType=INTEGER}, priviledge_birthday = #{priviledgeBirthday,jdbcType=INTEGER}, - note = #{note,jdbcType=VARCHAR} + note = #{note,jdbcType=VARCHAR}, + commission_ratio = #{commissionRatio,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberRelationTreeMapper.xml b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberRelationTreeMapper.xml new file mode 100644 index 0000000..a485dfd --- /dev/null +++ b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberRelationTreeMapper.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, member_id, higher_level_id, quit_queue_mark, create_time + + + + + delete from ums_member_relation_tree + where id = #{id,jdbcType=BIGINT} + + + delete from ums_member_relation_tree + + + + + + + SELECT LAST_INSERT_ID() + + insert into ums_member_relation_tree (member_id, higher_level_id, quit_queue_mark, + create_time) + values (#{memberId,jdbcType=BIGINT}, #{higherLevelId,jdbcType=INTEGER}, #{quitQueueMark,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}) + + + + SELECT LAST_INSERT_ID() + + insert into ums_member_relation_tree + + + member_id, + + + higher_level_id, + + + quit_queue_mark, + + + create_time, + + + + + #{memberId,jdbcType=BIGINT}, + + + #{higherLevelId,jdbcType=INTEGER}, + + + #{quitQueueMark,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + update ums_member_relation_tree + + + id = #{record.id,jdbcType=BIGINT}, + + + member_id = #{record.memberId,jdbcType=BIGINT}, + + + higher_level_id = #{record.higherLevelId,jdbcType=INTEGER}, + + + quit_queue_mark = #{record.quitQueueMark,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + + + + + + update ums_member_relation_tree + set id = #{record.id,jdbcType=BIGINT}, + member_id = #{record.memberId,jdbcType=BIGINT}, + higher_level_id = #{record.higherLevelId,jdbcType=INTEGER}, + quit_queue_mark = #{record.quitQueueMark,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP} + + + + + + update ums_member_relation_tree + + + member_id = #{memberId,jdbcType=BIGINT}, + + + higher_level_id = #{higherLevelId,jdbcType=INTEGER}, + + + quit_queue_mark = #{quitQueueMark,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update ums_member_relation_tree + set member_id = #{memberId,jdbcType=BIGINT}, + higher_level_id = #{higherLevelId,jdbcType=INTEGER}, + quit_queue_mark = #{quitQueueMark,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/controller/OmsPortalOrderController.java b/mall-portal/src/main/java/com/buy507/mall/portal/controller/OmsPortalOrderController.java index 8002c0f..d27daef 100644 --- a/mall-portal/src/main/java/com/buy507/mall/portal/controller/OmsPortalOrderController.java +++ b/mall-portal/src/main/java/com/buy507/mall/portal/controller/OmsPortalOrderController.java @@ -2,6 +2,8 @@ package com.buy507.mall.portal.controller; import java.io.IOException; import java.io.OutputStream; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -166,13 +168,13 @@ public class OmsPortalOrderController { /** - * 支付宝支付成功回调方法 - * @param request - * @param response + * 支付宝支付回调方法 + * @param params */ + @ApiOperation("支付宝支付回调") @RequestMapping("/alipay/callback") - public void alipayCallback(HttpServletRequest request, HttpServletResponse response) throws Exception { - portalOrderService.wxPayCallback(request, response); + public void alipayCallback(@RequestParam Map params) { + portalOrderService.alipayCallback(params); } } diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/service/OmsPortalOrderService.java b/mall-portal/src/main/java/com/buy507/mall/portal/service/OmsPortalOrderService.java index de75e72..b8a4d50 100644 --- a/mall-portal/src/main/java/com/buy507/mall/portal/service/OmsPortalOrderService.java +++ b/mall-portal/src/main/java/com/buy507/mall/portal/service/OmsPortalOrderService.java @@ -89,7 +89,7 @@ public interface OmsPortalOrderService { CommonResult> wxPrePay(Long orderId); /** - * 支付宝预支付 + * 支付宝跳转 * @param orderId * @return */ @@ -101,5 +101,10 @@ public interface OmsPortalOrderService { * @param response */ void wxPayCallback(HttpServletRequest request, HttpServletResponse response) throws Exception; - + /** + * 支付宝支付成功回调方法 + * @param request + * @param response + */ + void alipayCallback(Map params); } diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java index 7da7d25..1626d1e 100644 --- a/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java +++ b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java @@ -6,16 +6,18 @@ import java.math.BigDecimal; import java.net.URI; import java.nio.charset.Charset; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ExecutorService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import cn.hutool.json.JSON; +import cn.hutool.json.JSONUtil; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayConfig; +import com.alipay.api.internal.util.AlipaySignature; +import com.buy507.mall.model.*; import com.buy507.mall.portal.domain.*; import com.buy507.mall.portal.service.*; import org.slf4j.Logger; @@ -46,23 +48,6 @@ import com.buy507.mall.mapper.PmsProductMapper; import com.buy507.mall.mapper.PmsSkuStockMapper; import com.buy507.mall.mapper.UmsMemberMapper; import com.buy507.mall.mapper.UmsMemberReceiveAddressMapper; -import com.buy507.mall.model.DmsMemberTradeRecord; -import com.buy507.mall.model.DmsOfflinePaymentRecord; -import com.buy507.mall.model.DmsSellerBankAccount; -import com.buy507.mall.model.ItemType; -import com.buy507.mall.model.OmsCartItem; -import com.buy507.mall.model.OmsCartItemExample; -import com.buy507.mall.model.OmsExpressCompany; -import com.buy507.mall.model.OmsOrder; -import com.buy507.mall.model.OmsOrderExample; -import com.buy507.mall.model.OmsOrderItem; -import com.buy507.mall.model.OmsOrderItemExample; -import com.buy507.mall.model.OmsOrderOperateHistory; -import com.buy507.mall.model.OmsOrderSetting; -import com.buy507.mall.model.PmsProduct; -import com.buy507.mall.model.PmsSkuStock; -import com.buy507.mall.model.UmsMember; -import com.buy507.mall.model.UmsMemberReceiveAddress; import com.buy507.mall.portal.component.CancelOrderSender; import com.buy507.mall.portal.component.DistributeSender; import com.buy507.mall.portal.component.RedisLock; @@ -1267,7 +1252,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { long time = System.currentTimeMillis() + RedisLock.TIMEOUT; if(redisLock.lock(String.valueOf(member.getId()), String.valueOf(time))) { member = memberMapper.selectByPrimaryKey(member.getId()); - member.setFreeze(member.getFreeze().subtract(order.getIntegrationAmount())); //修改冻结金额 + member.setFreeze(member.getFreeze().add(order.getIntegrationAmount())); //修改冻结金额,增加冻结资金 memberMapper.updateByPrimaryKey(member); redisLock.unlock(String.valueOf(member.getId()), String.valueOf(time)); break; @@ -1521,50 +1506,51 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { OmsOrder order = list.get(0); //订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单 if(order != null && order.getStatus() == 0) { - Date date = new Date(); - //提货方式:0->自提;1->物流 - if(order.getDeliveryType() == 0) { - order.setStatus(2); //已发货 - } else { - order.setStatus(1); //待发货 - } - //支付方式:0->未支付;1->支付宝;2->微信;3->线下支付 - order.setPayType(2); //微信 - order.setModifyTime(date); - order.setPaymentTime(date); - orderMapper.updateByPrimaryKey(order); - - BigDecimal zero = new BigDecimal(0); - int flag = order.getIntegrationAmount().compareTo(zero); - UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId()); - - //flag = -1,表示IntegrationAmount小于zero;flag = 0,表示IntegrationAmount等于zero;flag = 1,表示IntegrationAmount大于zero; - if(flag == 1) { - - //写入会员交易记录表 - DmsMemberTradeRecord tradeRecord = new DmsMemberTradeRecord(); - tradeRecord.setMemberId(member.getId()); - tradeRecord.setItemType(ItemType.IntegralShopping); //积分购物 - tradeRecord.setNote("积分抵扣"); - tradeRecord.setTitle("积分抵扣"); - tradeRecord.setValue(order.getIntegrationAmount()); - tradeRecord.setType(1); //收支类型:0->收入;1->支出 - tradeRecord.setCreateTime(date); - memberTradeRecordMapper.insert(tradeRecord); - - while(true) { - long time = System.currentTimeMillis() + RedisLock.TIMEOUT; - if(redisLock.lock(String.valueOf(member.getId()), String.valueOf(time))) { - member = memberMapper.selectByPrimaryKey(member.getId()); - member.setFreeze(member.getFreeze().subtract(order.getIntegrationAmount())); //修改冻结值 - memberMapper.updateByPrimaryKey(member); - redisLock.unlock(String.valueOf(member.getId()), String.valueOf(time)); - break; - } - } - - } - + + Date date = new Date(); + //提货方式:0->自提;1->物流 + if(order.getDeliveryType() == 0) { + order.setStatus(2); //已发货 + } else { + order.setStatus(1); //待发货 + } + //支付方式:0->未支付;1->支付宝;2->微信;3->线下支付 + order.setPayType(2); //微信 + order.setModifyTime(date); + order.setPaymentTime(date); + orderMapper.updateByPrimaryKey(order); + + BigDecimal zero = new BigDecimal(0); + int flag = order.getIntegrationAmount().compareTo(zero); + UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId()); + + //flag = -1,表示IntegrationAmount小于zero;flag = 0,表示IntegrationAmount等于zero;flag = 1,表示IntegrationAmount大于zero; + if(flag == 1) { + + //写入会员交易记录表 + DmsMemberTradeRecord tradeRecord = new DmsMemberTradeRecord(); + tradeRecord.setMemberId(member.getId()); + tradeRecord.setItemType(ItemType.IntegralShopping); //积分购物 + tradeRecord.setNote("积分抵扣"); + tradeRecord.setTitle("积分抵扣"); + tradeRecord.setValue(order.getIntegrationAmount()); + tradeRecord.setType(1); //收支类型:0->收入;1->支出 + tradeRecord.setCreateTime(date); + memberTradeRecordMapper.insert(tradeRecord); + + while(true) { + long time = System.currentTimeMillis() + RedisLock.TIMEOUT; + if(redisLock.lock(String.valueOf(member.getId()), String.valueOf(time))) { + member = memberMapper.selectByPrimaryKey(member.getId()); + member.setFreeze(member.getFreeze().subtract(order.getIntegrationAmount())); //修改冻结值 + memberMapper.updateByPrimaryKey(member); + redisLock.unlock(String.valueOf(member.getId()), String.valueOf(time)); + break; + } + } + + } + //修改商品库存信息需要加锁,影响前台响应,所以用线程来处理 executorService.execute(new Runnable() { @@ -1644,4 +1630,98 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { } + @Value("${alipay.alipayPublicKey}") + private String alipayPublicKey; + + @Value("${alipay.charset}") + private String charset; + + @Value("${alipay.signType}") + private String signType; + + @Value("${becomeVipAmount}") + private String becomeVipAmount; + + + @Override + public void alipayCallback(Map params) { + LOGGER.info("============开始处理支付宝的支付异步通知 接收到参数 {}", JSONUtil.toJsonStr(params)); + // 验证签名 + boolean verifyResult; + try { + verifyResult = AlipaySignature.rsaCheckV1(params, alipayPublicKey, charset, signType); + + if (verifyResult) { + // 签名验证通过 + String tradeStatus = params.get("trade_status"); + String outTradeNo = params.get("out_trade_no"); + if ("TRADE_SUCCESS".equals(tradeStatus) || "TRADE_FINISHED".equals(tradeStatus)) { + // 处理支付成功的业务逻辑 + OmsOrderExample example = new OmsOrderExample(); + example.createCriteria().andOrderSnEqualTo(outTradeNo); + List list = orderMapper.selectByExample(example); + if(list != null && list.size() > 0) { + OmsOrder order = list.get(0); + //订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单 + if (order != null && order.getStatus() == 0) { + // 更新订单状态 + this.updateOderAndMemberInfo(order); + } + } + } + } + + } catch (AlipayApiException e) { + e.printStackTrace(); + } + } + + private void updateOderAndMemberInfo(OmsOrder order) { + + Date date = new Date(); + //提货方式:0->自提;1->物流 + if(order.getDeliveryType() == 0) { + order.setStatus(2); //已发货 + } else { + order.setStatus(1); //待发货 + } + //支付方式:0->未支付;1->支付宝;2->微信;3->线下支付 + order.setPayType(1); + order.setModifyTime(date); + order.setPaymentTime(date); + orderMapper.updateByPrimaryKey(order); + + //新增用户位普通用户,订单支付成功后满一定金额,成为vip普通会员 + + UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId()); + //普通用户 + if(member.getMemberLevel().equals(MemberLevel.Member) ){ + /** + * 当前订单金额 大于等于 vip门槛金额 + */ + if(order.getPayAmount().compareTo(new BigDecimal(becomeVipAmount)) >= 0 ){ + member.setMemberLevel(MemberLevel.Consumer); + memberMapper.updateByPrimaryKey(member); + } +// else { +// /** +// * 订单统计累计 +// */ +// OmsOrderExample example = new OmsOrderExample(); +// example.createCriteria().andMemberIdEqualTo(order.getMemberId()).andStatusEqualTo(3); +// List list = orderMapper.selectByExample(example); +// if(list != null && !list.isEmpty()){ +// BigDecimal totalAmount = list.stream().map(OmsOrder::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add); +// totalAmount = totalAmount.add(order.getPayAmount()); +// if(totalAmount.compareTo(vipAmount) >= 0 ){ +// member.setMemberLevel(MemberLevel.Partner); +// memberMapper.updateByPrimaryKey(member); +// } +// } +// } + } + + } + + }