下单接口完善,添加支付成功回调及自动取消超时订单接口

This commit is contained in:
zhh
2018-09-05 17:05:11 +08:00
parent cae7f7e4f8
commit cbdb93ee3f
21 changed files with 872 additions and 423 deletions

View File

@@ -11,6 +11,7 @@ mybatis.mapper-locations=classpath:dao/*.xml,classpath*:com/**/mapper/*.xml
#===redis custom key start===
redis.key.prefix.authCode=portal:authCode:
redis.key.prefix.orderId=portal:orderId:
authCode.expire.seconds=90
#===redis custom key end===

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.portal.dao.PortalOrderDao">
<resultMap id="orderDetailMap" type="com.macro.mall.portal.domain.OmsOrderDetail"
extends="com.macro.mall.mapper.OmsOrderMapper.BaseResultMap">
<collection property="orderItemList" columnPrefix="ot_"
resultMap="com.macro.mall.mapper.OmsOrderItemMapper.BaseResultMap">
</collection>
</resultMap>
<select id="getDetail" resultMap="orderDetailMap">
SELECT
o.id,
o.order_sn,
o.coupon_id,
o.integration,
o.member_id,
ot.id ot_id,
ot.product_name ot_product_name,
ot.product_sku_id ot_product_sku_id,
ot.product_sku_code ot_product_sku_code,
ot.product_quantity ot_product_quantity
FROM
oms_order o
LEFT JOIN oms_order_item ot ON o.id = ot.order_id
WHERE
o.id = #{orderId}
</select>
<select id="getTimeOutOrders" resultMap="orderDetailMap">
SELECT
o.id,
o.order_sn,
o.coupon_id,
o.integration,
o.member_id,
o.use_integration,
ot.id ot_id,
ot.product_name ot_product_name,
ot.product_sku_id ot_product_sku_id,
ot.product_sku_code ot_product_sku_code,
ot.product_quantity ot_product_quantity
FROM
oms_order o
LEFT JOIN oms_order_item ot ON o.id = ot.order_id
WHERE
o.status = 0
AND o.create_time &lt; date_add(NOW(), INTERVAL -#{minute} MINUTE);
</select>
<update id="updateSkuStock">
UPDATE pms_sku_stock
SET
stock = CASE id
<foreach collection="itemList" item="item">
WHEN #{item.productSkuId} THEN stock - #{item.productQuantity}
</foreach>
END,
lock_stock = CASE id
<foreach collection="itemList" item="item">
WHEN #{item.productSkuId} THEN lock_stock - #{item.productQuantity}
</foreach>
END
WHERE
id IN
<foreach collection="itemList" item="item" separator="," open="(" close=")">
#{item.productSkuId}
</foreach>
</update>
<update id="updateOrderStatus">
update oms_order
set status=#{status}
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<update id="releaseSkuStockLock">
UPDATE pms_sku_stock
SET
lock_stock = CASE id
<foreach collection="itemList" item="item">
WHEN #{item.productSkuId} THEN lock_stock - #{item.productQuantity}
</foreach>
END
WHERE
id IN
<foreach collection="itemList" item="item" separator="," open="(" close=")">
#{item.productSkuId}
</foreach>
</update>
</mapper>