订单接口改进

This commit is contained in:
zhh 2018-10-26 16:57:06 +08:00
parent 168dc0b10b
commit e90c511f66
10 changed files with 742 additions and 488 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -73,6 +73,7 @@
oi.product_brand item_product_brand,
oi.product_price item_product_price,
oi.product_quantity item_product_quantity,
oi.product_attr item_product_attr,
oi.sp1 item_sp1,
oi.sp2 item_sp2,
oi.sp3 item_sp3,
@ -87,5 +88,6 @@
LEFT JOIN oms_order_operate_history oh ON o.id = oh.order_id
WHERE
o.id = #{id}
ORDER BY oi.id ASC,oh.create_time DESC
</select>
</mapper>

View File

@ -115,6 +115,13 @@ public class OmsCartItem implements Serializable {
private String productSn;
/**
* 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]
*
* @mbggenerated
*/
private String productAttr;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -277,6 +284,14 @@ public class OmsCartItem implements Serializable {
this.productSn = productSn;
}
public String getProductAttr() {
return productAttr;
}
public void setProductAttr(String productAttr) {
this.productAttr = productAttr;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -303,6 +318,7 @@ public class OmsCartItem implements Serializable {
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", productBrand=").append(productBrand);
sb.append(", productSn=").append(productSn);
sb.append(", productAttr=").append(productAttr);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -1405,6 +1405,76 @@ public class OmsCartItemExample {
addCriterion("product_sn not between", value1, value2, "productSn");
return (Criteria) this;
}
public Criteria andProductAttrIsNull() {
addCriterion("product_attr is null");
return (Criteria) this;
}
public Criteria andProductAttrIsNotNull() {
addCriterion("product_attr is not null");
return (Criteria) this;
}
public Criteria andProductAttrEqualTo(String value) {
addCriterion("product_attr =", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotEqualTo(String value) {
addCriterion("product_attr <>", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrGreaterThan(String value) {
addCriterion("product_attr >", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrGreaterThanOrEqualTo(String value) {
addCriterion("product_attr >=", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLessThan(String value) {
addCriterion("product_attr <", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLessThanOrEqualTo(String value) {
addCriterion("product_attr <=", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLike(String value) {
addCriterion("product_attr like", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotLike(String value) {
addCriterion("product_attr not like", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrIn(List<String> values) {
addCriterion("product_attr in", values, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotIn(List<String> values) {
addCriterion("product_attr not in", values, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrBetween(String value1, String value2) {
addCriterion("product_attr between", value1, value2, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotBetween(String value1, String value2) {
addCriterion("product_attr not between", value1, value2, "productAttr");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -115,6 +115,13 @@ public class OmsOrderItem implements Serializable {
private Integer giftGrowth;
/**
* 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]
*
* @mbggenerated
*/
private String productAttr;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -301,6 +308,14 @@ public class OmsOrderItem implements Serializable {
this.giftGrowth = giftGrowth;
}
public String getProductAttr() {
return productAttr;
}
public void setProductAttr(String productAttr) {
this.productAttr = productAttr;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -330,6 +345,7 @@ public class OmsOrderItem implements Serializable {
sb.append(", realAmount=").append(realAmount);
sb.append(", giftIntegration=").append(giftIntegration);
sb.append(", giftGrowth=").append(giftGrowth);
sb.append(", productAttr=").append(productAttr);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@ -1584,6 +1584,76 @@ public class OmsOrderItemExample {
addCriterion("gift_growth not between", value1, value2, "giftGrowth");
return (Criteria) this;
}
public Criteria andProductAttrIsNull() {
addCriterion("product_attr is null");
return (Criteria) this;
}
public Criteria andProductAttrIsNotNull() {
addCriterion("product_attr is not null");
return (Criteria) this;
}
public Criteria andProductAttrEqualTo(String value) {
addCriterion("product_attr =", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotEqualTo(String value) {
addCriterion("product_attr <>", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrGreaterThan(String value) {
addCriterion("product_attr >", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrGreaterThanOrEqualTo(String value) {
addCriterion("product_attr >=", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLessThan(String value) {
addCriterion("product_attr <", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLessThanOrEqualTo(String value) {
addCriterion("product_attr <=", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrLike(String value) {
addCriterion("product_attr like", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotLike(String value) {
addCriterion("product_attr not like", value, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrIn(List<String> values) {
addCriterion("product_attr in", values, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotIn(List<String> values) {
addCriterion("product_attr not in", values, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrBetween(String value1, String value2) {
addCriterion("product_attr between", value1, value2, "productAttr");
return (Criteria) this;
}
public Criteria andProductAttrNotBetween(String value1, String value2) {
addCriterion("product_attr not between", value1, value2, "productAttr");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -22,6 +22,7 @@
<result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
<result column="product_brand" jdbcType="VARCHAR" property="productBrand" />
<result column="product_sn" jdbcType="VARCHAR" property="productSn" />
<result column="product_attr" jdbcType="VARCHAR" property="productAttr" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -84,7 +85,7 @@
<sql id="Base_Column_List">
id, product_id, product_sku_id, member_id, quantity, price, sp1, sp2, sp3, product_pic,
product_name, product_sub_title, product_sku_code, member_nickname, create_date,
modify_date, delete_status, product_category_id, product_brand, product_sn
modify_date, delete_status, product_category_id, product_brand, product_sn, product_attr
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.OmsCartItemExample" resultMap="BaseResultMap">
select
@ -126,14 +127,14 @@
product_name, product_sub_title, product_sku_code,
member_nickname, create_date, modify_date,
delete_status, product_category_id, product_brand,
product_sn)
product_sn, product_attr)
values (#{productId,jdbcType=BIGINT}, #{productSkuId,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT},
#{quantity,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, #{sp1,jdbcType=VARCHAR},
#{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{productPic,jdbcType=VARCHAR},
#{productName,jdbcType=VARCHAR}, #{productSubTitle,jdbcType=VARCHAR}, #{productSkuCode,jdbcType=VARCHAR},
#{memberNickname,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP},
#{deleteStatus,jdbcType=INTEGER}, #{productCategoryId,jdbcType=BIGINT}, #{productBrand,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR})
#{productSn,jdbcType=VARCHAR}, #{productAttr,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsCartItem">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -198,6 +199,9 @@
<if test="productSn != null">
product_sn,
</if>
<if test="productAttr != null">
product_attr,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productId != null">
@ -257,6 +261,9 @@
<if test="productSn != null">
#{productSn,jdbcType=VARCHAR},
</if>
<if test="productAttr != null">
#{productAttr,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.OmsCartItemExample" resultType="java.lang.Integer">
@ -328,6 +335,9 @@
<if test="record.productSn != null">
product_sn = #{record.productSn,jdbcType=VARCHAR},
</if>
<if test="record.productAttr != null">
product_attr = #{record.productAttr,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -354,7 +364,8 @@
delete_status = #{record.deleteStatus,jdbcType=INTEGER},
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
product_brand = #{record.productBrand,jdbcType=VARCHAR},
product_sn = #{record.productSn,jdbcType=VARCHAR}
product_sn = #{record.productSn,jdbcType=VARCHAR},
product_attr = #{record.productAttr,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -419,6 +430,9 @@
<if test="productSn != null">
product_sn = #{productSn,jdbcType=VARCHAR},
</if>
<if test="productAttr != null">
product_attr = #{productAttr,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -442,7 +456,8 @@
delete_status = #{deleteStatus,jdbcType=INTEGER},
product_category_id = #{productCategoryId,jdbcType=BIGINT},
product_brand = #{productBrand,jdbcType=VARCHAR},
product_sn = #{productSn,jdbcType=VARCHAR}
product_sn = #{productSn,jdbcType=VARCHAR},
product_attr = #{productAttr,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -25,6 +25,7 @@
<result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
<result column="gift_integration" jdbcType="INTEGER" property="giftIntegration" />
<result column="gift_growth" jdbcType="INTEGER" property="giftGrowth" />
<result column="product_attr" jdbcType="VARCHAR" property="productAttr" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -88,7 +89,7 @@
id, order_id, order_sn, product_id, product_pic, product_name, product_brand, product_sn,
product_price, product_quantity, product_sku_id, product_sku_code, product_category_id,
sp1, sp2, sp3, promotion_name, promotion_amount, coupon_amount, integration_amount,
real_amount, gift_integration, gift_growth
real_amount, gift_integration, gift_growth, product_attr
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.OmsOrderItemExample" resultMap="BaseResultMap">
select
@ -130,16 +131,16 @@
product_sku_id, product_sku_code, product_category_id,
sp1, sp2, sp3, promotion_name,
promotion_amount, coupon_amount, integration_amount,
real_amount, gift_integration, gift_growth
)
real_amount, gift_integration, gift_growth,
product_attr)
values (#{orderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, #{productId,jdbcType=BIGINT},
#{productPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{productBrand,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR}, #{productPrice,jdbcType=DECIMAL}, #{productQuantity,jdbcType=INTEGER},
#{productSkuId,jdbcType=BIGINT}, #{productSkuCode,jdbcType=VARCHAR}, #{productCategoryId,jdbcType=BIGINT},
#{sp1,jdbcType=VARCHAR}, #{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{promotionName,jdbcType=VARCHAR},
#{promotionAmount,jdbcType=DECIMAL}, #{couponAmount,jdbcType=DECIMAL}, #{integrationAmount,jdbcType=DECIMAL},
#{realAmount,jdbcType=DECIMAL}, #{giftIntegration,jdbcType=INTEGER}, #{giftGrowth,jdbcType=INTEGER}
)
#{realAmount,jdbcType=DECIMAL}, #{giftIntegration,jdbcType=INTEGER}, #{giftGrowth,jdbcType=INTEGER},
#{productAttr,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrderItem">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -213,6 +214,9 @@
<if test="giftGrowth != null">
gift_growth,
</if>
<if test="productAttr != null">
product_attr,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">
@ -281,6 +285,9 @@
<if test="giftGrowth != null">
#{giftGrowth,jdbcType=INTEGER},
</if>
<if test="productAttr != null">
#{productAttr,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.OmsOrderItemExample" resultType="java.lang.Integer">
@ -361,6 +368,9 @@
<if test="record.giftGrowth != null">
gift_growth = #{record.giftGrowth,jdbcType=INTEGER},
</if>
<if test="record.productAttr != null">
product_attr = #{record.productAttr,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -390,7 +400,8 @@
integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
real_amount = #{record.realAmount,jdbcType=DECIMAL},
gift_integration = #{record.giftIntegration,jdbcType=INTEGER},
gift_growth = #{record.giftGrowth,jdbcType=INTEGER}
gift_growth = #{record.giftGrowth,jdbcType=INTEGER},
product_attr = #{record.productAttr,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -464,6 +475,9 @@
<if test="giftGrowth != null">
gift_growth = #{giftGrowth,jdbcType=INTEGER},
</if>
<if test="productAttr != null">
product_attr = #{productAttr,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -490,7 +504,8 @@
integration_amount = #{integrationAmount,jdbcType=DECIMAL},
real_amount = #{realAmount,jdbcType=DECIMAL},
gift_integration = #{giftIntegration,jdbcType=INTEGER},
gift_growth = #{giftGrowth,jdbcType=INTEGER}
gift_growth = #{giftGrowth,jdbcType=INTEGER},
product_attr = #{productAttr,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -93,6 +93,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
orderItem.setProductId(cartPromotionItem.getProductId());
orderItem.setProductName(cartPromotionItem.getProductName());
orderItem.setProductPic(cartPromotionItem.getProductPic());
orderItem.setProductAttr(cartPromotionItem.getProductAttr());
orderItem.setProductBrand(cartPromotionItem.getProductBrand());
orderItem.setProductSn(cartPromotionItem.getProductSn());
orderItem.setProductPrice(cartPromotionItem.getPrice());
@ -151,6 +152,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
lockStock(cartPromotionItemList);
//根据商品合计运费活动优惠优惠券积分计算应付金额
OmsOrder order = new OmsOrder();
order.setDiscountAmount(new BigDecimal(0));
order.setTotalAmount(calcTotalAmount(orderItemList));
order.setFreightAmount(new BigDecimal(0));
order.setPromotionAmount(calcPromotionAmount(orderItemList));