diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapper.java b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapper.java index 8d482d39..b030bbbd 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapper.java @@ -39,12 +39,20 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_discount_user_rel (discount_id, agent_id, ", + "insert into high_discount_user_rel (discount_company_id, discount_id, ", + "discount_name, discount_img, ", + "discount_using_range, discount_use_scope, ", + "discount_type, discount_condition, ", + "discount_price, agent_id, ", "discount_agent_code_id, user_id, ", "`status`, use_time, ", "create_time, use_end_time, ", "ext_1, ext_2, ext_3)", - "values (#{discountId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ", + "values (#{discountCompanyId,jdbcType=BIGINT}, #{discountId,jdbcType=BIGINT}, ", + "#{discountName,jdbcType=VARCHAR}, #{discountImg,jdbcType=VARCHAR}, ", + "#{discountUsingRange,jdbcType=INTEGER}, #{discountUseScope,jdbcType=INTEGER}, ", + "#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ", + "#{discountPrice,jdbcType=DECIMAL}, #{agentId,jdbcType=BIGINT}, ", "#{discountAgentCodeId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, ", "#{status,jdbcType=INTEGER}, #{useTime,jdbcType=TIMESTAMP}, ", "#{createTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ", @@ -60,7 +68,15 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt @SelectProvider(type=HighDiscountUserRelSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="discount_company_id", property="discountCompanyId", jdbcType=JdbcType.BIGINT), @Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), + @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), + @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR), + @Result(column="discount_using_range", property="discountUsingRange", jdbcType=JdbcType.INTEGER), + @Result(column="discount_use_scope", property="discountUseScope", jdbcType=JdbcType.INTEGER), + @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), + @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), + @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="discount_agent_code_id", property="discountAgentCodeId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @@ -76,14 +92,24 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt @Select({ "select", - "id, discount_id, agent_id, discount_agent_code_id, user_id, `status`, use_time, ", - "create_time, use_end_time, ext_1, ext_2, ext_3", + "id, discount_company_id, discount_id, discount_name, discount_img, discount_using_range, ", + "discount_use_scope, discount_type, discount_condition, discount_price, agent_id, ", + "discount_agent_code_id, user_id, `status`, use_time, create_time, use_end_time, ", + "ext_1, ext_2, ext_3", "from high_discount_user_rel", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="discount_company_id", property="discountCompanyId", jdbcType=JdbcType.BIGINT), @Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), + @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), + @Result(column="discount_img", property="discountImg", jdbcType=JdbcType.VARCHAR), + @Result(column="discount_using_range", property="discountUsingRange", jdbcType=JdbcType.INTEGER), + @Result(column="discount_use_scope", property="discountUseScope", jdbcType=JdbcType.INTEGER), + @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), + @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), + @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), @Result(column="discount_agent_code_id", property="discountAgentCodeId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @@ -108,7 +134,15 @@ public interface HighDiscountUserRelMapper extends HighDiscountUserRelMapperExt @Update({ "update high_discount_user_rel", - "set discount_id = #{discountId,jdbcType=BIGINT},", + "set discount_company_id = #{discountCompanyId,jdbcType=BIGINT},", + "discount_id = #{discountId,jdbcType=BIGINT},", + "discount_name = #{discountName,jdbcType=VARCHAR},", + "discount_img = #{discountImg,jdbcType=VARCHAR},", + "discount_using_range = #{discountUsingRange,jdbcType=INTEGER},", + "discount_use_scope = #{discountUseScope,jdbcType=INTEGER},", + "discount_type = #{discountType,jdbcType=INTEGER},", + "discount_condition = #{discountCondition,jdbcType=DECIMAL},", + "discount_price = #{discountPrice,jdbcType=DECIMAL},", "agent_id = #{agentId,jdbcType=BIGINT},", "discount_agent_code_id = #{discountAgentCodeId,jdbcType=BIGINT},", "user_id = #{userId,jdbcType=BIGINT},", diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelSqlProvider.java index 37a99bc8..6219ee6b 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelSqlProvider.java @@ -28,10 +28,42 @@ public class HighDiscountUserRelSqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("high_discount_user_rel"); + if (record.getDiscountCompanyId() != null) { + sql.VALUES("discount_company_id", "#{discountCompanyId,jdbcType=BIGINT}"); + } + if (record.getDiscountId() != null) { sql.VALUES("discount_id", "#{discountId,jdbcType=BIGINT}"); } + if (record.getDiscountName() != null) { + sql.VALUES("discount_name", "#{discountName,jdbcType=VARCHAR}"); + } + + if (record.getDiscountImg() != null) { + sql.VALUES("discount_img", "#{discountImg,jdbcType=VARCHAR}"); + } + + if (record.getDiscountUsingRange() != null) { + sql.VALUES("discount_using_range", "#{discountUsingRange,jdbcType=INTEGER}"); + } + + if (record.getDiscountUseScope() != null) { + sql.VALUES("discount_use_scope", "#{discountUseScope,jdbcType=INTEGER}"); + } + + if (record.getDiscountType() != null) { + sql.VALUES("discount_type", "#{discountType,jdbcType=INTEGER}"); + } + + if (record.getDiscountCondition() != null) { + sql.VALUES("discount_condition", "#{discountCondition,jdbcType=DECIMAL}"); + } + + if (record.getDiscountPrice() != null) { + sql.VALUES("discount_price", "#{discountPrice,jdbcType=DECIMAL}"); + } + if (record.getAgentId() != null) { sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}"); } @@ -82,7 +114,15 @@ public class HighDiscountUserRelSqlProvider { } else { sql.SELECT("id"); } + sql.SELECT("discount_company_id"); sql.SELECT("discount_id"); + sql.SELECT("discount_name"); + sql.SELECT("discount_img"); + sql.SELECT("discount_using_range"); + sql.SELECT("discount_use_scope"); + sql.SELECT("discount_type"); + sql.SELECT("discount_condition"); + sql.SELECT("discount_price"); sql.SELECT("agent_id"); sql.SELECT("discount_agent_code_id"); sql.SELECT("user_id"); @@ -114,10 +154,42 @@ public class HighDiscountUserRelSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); } + if (record.getDiscountCompanyId() != null) { + sql.SET("discount_company_id = #{record.discountCompanyId,jdbcType=BIGINT}"); + } + if (record.getDiscountId() != null) { sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); } + if (record.getDiscountName() != null) { + sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); + } + + if (record.getDiscountImg() != null) { + sql.SET("discount_img = #{record.discountImg,jdbcType=VARCHAR}"); + } + + if (record.getDiscountUsingRange() != null) { + sql.SET("discount_using_range = #{record.discountUsingRange,jdbcType=INTEGER}"); + } + + if (record.getDiscountUseScope() != null) { + sql.SET("discount_use_scope = #{record.discountUseScope,jdbcType=INTEGER}"); + } + + if (record.getDiscountType() != null) { + sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}"); + } + + if (record.getDiscountCondition() != null) { + sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}"); + } + + if (record.getDiscountPrice() != null) { + sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); + } + if (record.getAgentId() != null) { sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); } @@ -167,7 +239,15 @@ public class HighDiscountUserRelSqlProvider { sql.UPDATE("high_discount_user_rel"); sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("discount_company_id = #{record.discountCompanyId,jdbcType=BIGINT}"); sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); + sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); + sql.SET("discount_img = #{record.discountImg,jdbcType=VARCHAR}"); + sql.SET("discount_using_range = #{record.discountUsingRange,jdbcType=INTEGER}"); + sql.SET("discount_use_scope = #{record.discountUseScope,jdbcType=INTEGER}"); + sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}"); + sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}"); + sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); sql.SET("discount_agent_code_id = #{record.discountAgentCodeId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); @@ -188,10 +268,42 @@ public class HighDiscountUserRelSqlProvider { SQL sql = new SQL(); sql.UPDATE("high_discount_user_rel"); + if (record.getDiscountCompanyId() != null) { + sql.SET("discount_company_id = #{discountCompanyId,jdbcType=BIGINT}"); + } + if (record.getDiscountId() != null) { sql.SET("discount_id = #{discountId,jdbcType=BIGINT}"); } + if (record.getDiscountName() != null) { + sql.SET("discount_name = #{discountName,jdbcType=VARCHAR}"); + } + + if (record.getDiscountImg() != null) { + sql.SET("discount_img = #{discountImg,jdbcType=VARCHAR}"); + } + + if (record.getDiscountUsingRange() != null) { + sql.SET("discount_using_range = #{discountUsingRange,jdbcType=INTEGER}"); + } + + if (record.getDiscountUseScope() != null) { + sql.SET("discount_use_scope = #{discountUseScope,jdbcType=INTEGER}"); + } + + if (record.getDiscountType() != null) { + sql.SET("discount_type = #{discountType,jdbcType=INTEGER}"); + } + + if (record.getDiscountCondition() != null) { + sql.SET("discount_condition = #{discountCondition,jdbcType=DECIMAL}"); + } + + if (record.getDiscountPrice() != null) { + sql.SET("discount_price = #{discountPrice,jdbcType=DECIMAL}"); + } + if (record.getAgentId() != null) { sql.SET("agent_id = #{agentId,jdbcType=BIGINT}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighDiscountUserRel.java b/hai-service/src/main/java/com/hai/entity/HighDiscountUserRel.java index 11e966a4..36c07a4a 100644 --- a/hai-service/src/main/java/com/hai/entity/HighDiscountUserRel.java +++ b/hai-service/src/main/java/com/hai/entity/HighDiscountUserRel.java @@ -3,6 +3,7 @@ package com.hai.entity; import com.hai.model.HighDiscountUserRelModel; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; /** @@ -20,11 +21,51 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser */ private Long id; + /** + * 优惠券发放公司 + */ + private Long discountCompanyId; + /** * 优惠券id */ private Long discountId; + /** + * 优惠券名称 + */ + private String discountName; + + /** + * 优惠券图片 + */ + private String discountImg; + + /** + * 使用归属 + */ + private Integer discountUsingRange; + + /** + * 使用范围 1. 全场 2.卡券 3.话费 + */ + private Integer discountUseScope; + + /** + * 卡卷类型 1:满减 2:抵扣 3:折扣 + */ + private Integer discountType; + + /** + * 优惠券条件(满减价格) + */ + private BigDecimal discountCondition; + + /** + * 优惠券价格 + */ + private BigDecimal discountPrice; + /** * 代理商id */ @@ -76,6 +117,14 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser this.id = id; } + public Long getDiscountCompanyId() { + return discountCompanyId; + } + + public void setDiscountCompanyId(Long discountCompanyId) { + this.discountCompanyId = discountCompanyId; + } + public Long getDiscountId() { return discountId; } @@ -84,6 +133,62 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser this.discountId = discountId; } + public String getDiscountName() { + return discountName; + } + + public void setDiscountName(String discountName) { + this.discountName = discountName; + } + + public String getDiscountImg() { + return discountImg; + } + + public void setDiscountImg(String discountImg) { + this.discountImg = discountImg; + } + + public Integer getDiscountUsingRange() { + return discountUsingRange; + } + + public void setDiscountUsingRange(Integer discountUsingRange) { + this.discountUsingRange = discountUsingRange; + } + + public Integer getDiscountUseScope() { + return discountUseScope; + } + + public void setDiscountUseScope(Integer discountUseScope) { + this.discountUseScope = discountUseScope; + } + + public Integer getDiscountType() { + return discountType; + } + + public void setDiscountType(Integer discountType) { + this.discountType = discountType; + } + + public BigDecimal getDiscountCondition() { + return discountCondition; + } + + public void setDiscountCondition(BigDecimal discountCondition) { + this.discountCondition = discountCondition; + } + + public BigDecimal getDiscountPrice() { + return discountPrice; + } + + public void setDiscountPrice(BigDecimal discountPrice) { + this.discountPrice = discountPrice; + } + public Long getAgentId() { return agentId; } @@ -177,7 +282,15 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser } HighDiscountUserRel other = (HighDiscountUserRel) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getDiscountCompanyId() == null ? other.getDiscountCompanyId() == null : this.getDiscountCompanyId().equals(other.getDiscountCompanyId())) && (this.getDiscountId() == null ? other.getDiscountId() == null : this.getDiscountId().equals(other.getDiscountId())) + && (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName())) + && (this.getDiscountImg() == null ? other.getDiscountImg() == null : this.getDiscountImg().equals(other.getDiscountImg())) + && (this.getDiscountUsingRange() == null ? other.getDiscountUsingRange() == null : this.getDiscountUsingRange().equals(other.getDiscountUsingRange())) + && (this.getDiscountUseScope() == null ? other.getDiscountUseScope() == null : this.getDiscountUseScope().equals(other.getDiscountUseScope())) + && (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType())) + && (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition())) + && (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice())) && (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) && (this.getDiscountAgentCodeId() == null ? other.getDiscountAgentCodeId() == null : this.getDiscountAgentCodeId().equals(other.getDiscountAgentCodeId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) @@ -195,7 +308,15 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getDiscountCompanyId() == null) ? 0 : getDiscountCompanyId().hashCode()); result = prime * result + ((getDiscountId() == null) ? 0 : getDiscountId().hashCode()); + result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode()); + result = prime * result + ((getDiscountImg() == null) ? 0 : getDiscountImg().hashCode()); + result = prime * result + ((getDiscountUsingRange() == null) ? 0 : getDiscountUsingRange().hashCode()); + result = prime * result + ((getDiscountUseScope() == null) ? 0 : getDiscountUseScope().hashCode()); + result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode()); + result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode()); + result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode()); result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); result = prime * result + ((getDiscountAgentCodeId() == null) ? 0 : getDiscountAgentCodeId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); @@ -216,7 +337,15 @@ public class HighDiscountUserRel extends HighDiscountUserRelModel implements Ser sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", discountCompanyId=").append(discountCompanyId); sb.append(", discountId=").append(discountId); + sb.append(", discountName=").append(discountName); + sb.append(", discountImg=").append(discountImg); + sb.append(", discountUsingRange=").append(discountUsingRange); + sb.append(", discountUseScope=").append(discountUseScope); + sb.append(", discountType=").append(discountType); + sb.append(", discountCondition=").append(discountCondition); + sb.append(", discountPrice=").append(discountPrice); sb.append(", agentId=").append(agentId); sb.append(", discountAgentCodeId=").append(discountAgentCodeId); sb.append(", userId=").append(userId); diff --git a/hai-service/src/main/java/com/hai/entity/HighDiscountUserRelExample.java b/hai-service/src/main/java/com/hai/entity/HighDiscountUserRelExample.java index 1c593d37..5aa9dfa3 100644 --- a/hai-service/src/main/java/com/hai/entity/HighDiscountUserRelExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighDiscountUserRelExample.java @@ -1,5 +1,6 @@ package com.hai.entity; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -185,6 +186,66 @@ public class HighDiscountUserRelExample { return (Criteria) this; } + public Criteria andDiscountCompanyIdIsNull() { + addCriterion("discount_company_id is null"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdIsNotNull() { + addCriterion("discount_company_id is not null"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdEqualTo(Long value) { + addCriterion("discount_company_id =", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdNotEqualTo(Long value) { + addCriterion("discount_company_id <>", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdGreaterThan(Long value) { + addCriterion("discount_company_id >", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdGreaterThanOrEqualTo(Long value) { + addCriterion("discount_company_id >=", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdLessThan(Long value) { + addCriterion("discount_company_id <", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdLessThanOrEqualTo(Long value) { + addCriterion("discount_company_id <=", value, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdIn(List values) { + addCriterion("discount_company_id in", values, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdNotIn(List values) { + addCriterion("discount_company_id not in", values, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdBetween(Long value1, Long value2) { + addCriterion("discount_company_id between", value1, value2, "discountCompanyId"); + return (Criteria) this; + } + + public Criteria andDiscountCompanyIdNotBetween(Long value1, Long value2) { + addCriterion("discount_company_id not between", value1, value2, "discountCompanyId"); + return (Criteria) this; + } + public Criteria andDiscountIdIsNull() { addCriterion("discount_id is null"); return (Criteria) this; @@ -245,6 +306,446 @@ public class HighDiscountUserRelExample { return (Criteria) this; } + public Criteria andDiscountNameIsNull() { + addCriterion("discount_name is null"); + return (Criteria) this; + } + + public Criteria andDiscountNameIsNotNull() { + addCriterion("discount_name is not null"); + return (Criteria) this; + } + + public Criteria andDiscountNameEqualTo(String value) { + addCriterion("discount_name =", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameNotEqualTo(String value) { + addCriterion("discount_name <>", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameGreaterThan(String value) { + addCriterion("discount_name >", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameGreaterThanOrEqualTo(String value) { + addCriterion("discount_name >=", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameLessThan(String value) { + addCriterion("discount_name <", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameLessThanOrEqualTo(String value) { + addCriterion("discount_name <=", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameLike(String value) { + addCriterion("discount_name like", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameNotLike(String value) { + addCriterion("discount_name not like", value, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameIn(List values) { + addCriterion("discount_name in", values, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameNotIn(List values) { + addCriterion("discount_name not in", values, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameBetween(String value1, String value2) { + addCriterion("discount_name between", value1, value2, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountNameNotBetween(String value1, String value2) { + addCriterion("discount_name not between", value1, value2, "discountName"); + return (Criteria) this; + } + + public Criteria andDiscountImgIsNull() { + addCriterion("discount_img is null"); + return (Criteria) this; + } + + public Criteria andDiscountImgIsNotNull() { + addCriterion("discount_img is not null"); + return (Criteria) this; + } + + public Criteria andDiscountImgEqualTo(String value) { + addCriterion("discount_img =", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgNotEqualTo(String value) { + addCriterion("discount_img <>", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgGreaterThan(String value) { + addCriterion("discount_img >", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgGreaterThanOrEqualTo(String value) { + addCriterion("discount_img >=", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgLessThan(String value) { + addCriterion("discount_img <", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgLessThanOrEqualTo(String value) { + addCriterion("discount_img <=", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgLike(String value) { + addCriterion("discount_img like", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgNotLike(String value) { + addCriterion("discount_img not like", value, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgIn(List values) { + addCriterion("discount_img in", values, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgNotIn(List values) { + addCriterion("discount_img not in", values, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgBetween(String value1, String value2) { + addCriterion("discount_img between", value1, value2, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountImgNotBetween(String value1, String value2) { + addCriterion("discount_img not between", value1, value2, "discountImg"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeIsNull() { + addCriterion("discount_using_range is null"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeIsNotNull() { + addCriterion("discount_using_range is not null"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeEqualTo(Integer value) { + addCriterion("discount_using_range =", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeNotEqualTo(Integer value) { + addCriterion("discount_using_range <>", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeGreaterThan(Integer value) { + addCriterion("discount_using_range >", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeGreaterThanOrEqualTo(Integer value) { + addCriterion("discount_using_range >=", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeLessThan(Integer value) { + addCriterion("discount_using_range <", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeLessThanOrEqualTo(Integer value) { + addCriterion("discount_using_range <=", value, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeIn(List values) { + addCriterion("discount_using_range in", values, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeNotIn(List values) { + addCriterion("discount_using_range not in", values, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeBetween(Integer value1, Integer value2) { + addCriterion("discount_using_range between", value1, value2, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUsingRangeNotBetween(Integer value1, Integer value2) { + addCriterion("discount_using_range not between", value1, value2, "discountUsingRange"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeIsNull() { + addCriterion("discount_use_scope is null"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeIsNotNull() { + addCriterion("discount_use_scope is not null"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeEqualTo(Integer value) { + addCriterion("discount_use_scope =", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeNotEqualTo(Integer value) { + addCriterion("discount_use_scope <>", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeGreaterThan(Integer value) { + addCriterion("discount_use_scope >", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeGreaterThanOrEqualTo(Integer value) { + addCriterion("discount_use_scope >=", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeLessThan(Integer value) { + addCriterion("discount_use_scope <", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeLessThanOrEqualTo(Integer value) { + addCriterion("discount_use_scope <=", value, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeIn(List values) { + addCriterion("discount_use_scope in", values, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeNotIn(List values) { + addCriterion("discount_use_scope not in", values, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeBetween(Integer value1, Integer value2) { + addCriterion("discount_use_scope between", value1, value2, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountUseScopeNotBetween(Integer value1, Integer value2) { + addCriterion("discount_use_scope not between", value1, value2, "discountUseScope"); + return (Criteria) this; + } + + public Criteria andDiscountTypeIsNull() { + addCriterion("discount_type is null"); + return (Criteria) this; + } + + public Criteria andDiscountTypeIsNotNull() { + addCriterion("discount_type is not null"); + return (Criteria) this; + } + + public Criteria andDiscountTypeEqualTo(Integer value) { + addCriterion("discount_type =", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeNotEqualTo(Integer value) { + addCriterion("discount_type <>", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeGreaterThan(Integer value) { + addCriterion("discount_type >", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("discount_type >=", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeLessThan(Integer value) { + addCriterion("discount_type <", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeLessThanOrEqualTo(Integer value) { + addCriterion("discount_type <=", value, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeIn(List values) { + addCriterion("discount_type in", values, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeNotIn(List values) { + addCriterion("discount_type not in", values, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeBetween(Integer value1, Integer value2) { + addCriterion("discount_type between", value1, value2, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountTypeNotBetween(Integer value1, Integer value2) { + addCriterion("discount_type not between", value1, value2, "discountType"); + return (Criteria) this; + } + + public Criteria andDiscountConditionIsNull() { + addCriterion("discount_condition is null"); + return (Criteria) this; + } + + public Criteria andDiscountConditionIsNotNull() { + addCriterion("discount_condition is not null"); + return (Criteria) this; + } + + public Criteria andDiscountConditionEqualTo(BigDecimal value) { + addCriterion("discount_condition =", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionNotEqualTo(BigDecimal value) { + addCriterion("discount_condition <>", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionGreaterThan(BigDecimal value) { + addCriterion("discount_condition >", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("discount_condition >=", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionLessThan(BigDecimal value) { + addCriterion("discount_condition <", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionLessThanOrEqualTo(BigDecimal value) { + addCriterion("discount_condition <=", value, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionIn(List values) { + addCriterion("discount_condition in", values, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionNotIn(List values) { + addCriterion("discount_condition not in", values, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_condition between", value1, value2, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountConditionNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_condition not between", value1, value2, "discountCondition"); + return (Criteria) this; + } + + public Criteria andDiscountPriceIsNull() { + addCriterion("discount_price is null"); + return (Criteria) this; + } + + public Criteria andDiscountPriceIsNotNull() { + addCriterion("discount_price is not null"); + return (Criteria) this; + } + + public Criteria andDiscountPriceEqualTo(BigDecimal value) { + addCriterion("discount_price =", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceNotEqualTo(BigDecimal value) { + addCriterion("discount_price <>", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceGreaterThan(BigDecimal value) { + addCriterion("discount_price >", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("discount_price >=", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceLessThan(BigDecimal value) { + addCriterion("discount_price <", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("discount_price <=", value, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceIn(List values) { + addCriterion("discount_price in", values, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceNotIn(List values) { + addCriterion("discount_price not in", values, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_price between", value1, value2, "discountPrice"); + return (Criteria) this; + } + + public Criteria andDiscountPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("discount_price not between", value1, value2, "discountPrice"); + return (Criteria) this; + } + public Criteria andAgentIdIsNull() { addCriterion("agent_id is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index bd539df5..95834d00 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -117,7 +117,7 @@ public class OrderServiceImpl implements OrderService { // 使用优惠券 if (createOrderModel.getMemDiscountId() != null) { // 卡优惠券信息 - discountUserRel = discountUserRelService.getRelById(createOrderModel.getMemId()); + discountUserRel = discountUserRelService.getRelById(createOrderModel.getMemDiscountId()); if (discountUserRel == null || discountUserRel.getStatus() != 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券不可用"); } @@ -265,8 +265,15 @@ public class OrderServiceImpl implements OrderService { order.setHighChildOrderList(childOrderList); /*********** 组装处理子订单 商品业务************/ + + // 计算订单金额 + Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); + order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); + order.setPayablePrice(new BigDecimal(calculateOrderPrice.get("payablePrice").toString())); + // 是否使用了优惠券 if (discountUserRel != null) { + order.setMemDiscountId(discountUserRel.getId()); order.setMemDiscountName(discountUserRel.getHighDiscount().getDiscountName()); // 优惠券使用范围 if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type1.getType())) { @@ -326,13 +333,8 @@ public class OrderServiceImpl implements OrderService { } } - // 计算订单金额 - Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); - order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); - order.setDeductionCouponPrice(order.getDeductionCouponPrice()); order.setDeductionProductPrice(new BigDecimal(calculateOrderPrice.get("deductionPrice").toString())); order.setTotalDeductionPrice(order.getDeductionCouponPrice().add(order.getDeductionProductPrice())); - order.setPayablePrice(new BigDecimal(calculateOrderPrice.get("payablePrice").toString())); order.setPayPrice(order.getPayablePrice()); // 积分抵扣 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java index 5f0c368b..f3cd8466 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java @@ -94,7 +94,15 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic }*/ HighDiscountUserRel userRel = new HighDiscountUserRel(); + userRel.setDiscountCompanyId(discount.getCompanyId()); userRel.setDiscountId(rel.getDiscountId()); + userRel.setDiscountName(discount.getDiscountName()); + userRel.setDiscountImg(discount.getDiscountImg()); + userRel.setDiscountUseScope(discount.getUseScope()); + userRel.setDiscountUsingRange(discount.getUsingRange()); + userRel.setDiscountType(discount.getDiscountType()); + userRel.setDiscountCondition(discount.getDiscountCondition()); + userRel.setDiscountPrice(discount.getDiscountPrice()); userRel.setAgentId(rel.getAgentId()); userRel.setUserId(userId); userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 @@ -233,13 +241,12 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } - example.setOrderByClause("create_time desc"); - List list = highDiscountUserRelMapper.selectByExample(example); - for (HighDiscountUserRel rel : list) { - rel.setHighDiscount(highDiscountService.getDiscountById(rel.getDiscountId())); - rel.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId())); + if (MapUtils.getInteger(map, "discountUseScope") != null) { + criteria.andDiscountUseScopeEqualTo(MapUtils.getInteger(map, "discountUseScope")); } - return list; + + example.setOrderByClause("create_time desc"); + return highDiscountUserRelMapper.selectByExample(example); } @Override diff --git a/hai-user/src/main/java/com/web/controller/DiscountController.java b/hai-user/src/main/java/com/web/controller/DiscountController.java index 50c5344d..ed3f754a 100644 --- a/hai-user/src/main/java/com/web/controller/DiscountController.java +++ b/hai-user/src/main/java/com/web/controller/DiscountController.java @@ -43,7 +43,7 @@ public class DiscountController { public ResponseData getUserDiscountList(@RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "useScope", required = false) Integer useScope, @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "ppageSizeageNum", required = true) Integer pageSize) { + @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); diff --git a/hai-user/src/main/java/com/web/controller/TestController.java b/hai-user/src/main/java/com/web/controller/TestController.java index 5bef80c0..d0a7159c 100644 --- a/hai-user/src/main/java/com/web/controller/TestController.java +++ b/hai-user/src/main/java/com/web/controller/TestController.java @@ -1 +1 @@ -package com.web.controller; import com.hai.common.utils.DateUtil; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.Date; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file +package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.DateUtil; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.Date; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance("8800030115015135432"); if (cardInfo.getInteger("respCode").equals(0000)) { // 解密响应参数 JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse.getBigDecimal("balance")); } return ResponseMsgUtil.success(0); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file diff --git a/hai-user/src/main/java/com/web/controller/UserController.java b/hai-user/src/main/java/com/web/controller/UserController.java index 2b0fd861..56868649 100644 --- a/hai-user/src/main/java/com/web/controller/UserController.java +++ b/hai-user/src/main/java/com/web/controller/UserController.java @@ -108,10 +108,12 @@ public class UserController { // 贵州汇联通工会卡 List hltCardList = userCardService.getListByUser(userInfoModel.getHighUser().getId(), UserCardType.type1.getType()); if (hltCardList.size() > 0) { - // 查询油卡 - JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(oilCardList.get(0).getCardNo()); - if (StringUtils.isBlank(cardInfo.getString("data"))) { - map.put("hltCardPrice", cardInfo.getString("data")); + // 查询工会卡 + JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(hltCardList.get(0).getCardNo()); + if (cardInfo.getInteger("respCode").equals(0000)) { + // 解密响应参数 + JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); + map.put("hltCardPrice", resolveResponse.getBigDecimal("balance")); } } return ResponseMsgUtil.success(map);