fix seller order detail data sql
Showing
6 changed files
with
70 additions
and
10 deletions
@@ -57,4 +57,5 @@ public interface SellerOrderGoodsMapper { | @@ -57,4 +57,5 @@ public interface SellerOrderGoodsMapper { | ||
57 | 57 | ||
58 | int insertBatch(@Param("records") Collection<SellerOrderGoods> records); | 58 | int insertBatch(@Param("records") Collection<SellerOrderGoods> records); |
59 | 59 | ||
60 | + SellerOrderGoods selectByUidStatusGBBN(SellerOrderGoods record); | ||
60 | } | 61 | } |
@@ -339,4 +339,14 @@ | @@ -339,4 +339,14 @@ | ||
339 | order by id desc | 339 | order by id desc |
340 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} | 340 | limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER} |
341 | </select> | 341 | </select> |
342 | + | ||
343 | + <select id="selectByUidStatusGBBN" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" resultMap="BaseResultMap"> | ||
344 | + select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods | ||
345 | + where uid = #{uid,jdbcType=INTEGER} and is_del = 1 | ||
346 | + and batch_no = #{batchNo,jdbcType=BIGINT} | ||
347 | + and goods_price = #{goodsPrice,jdbcType=DECIMAL} | ||
348 | + and status = #{status,jdbcType=TINYINT} | ||
349 | + group by batch_no , goods_price ,`status` | ||
350 | + limit 1 | ||
351 | + </select> | ||
342 | </mapper> | 352 | </mapper> |
@@ -10,16 +10,19 @@ import com.yohoufo.order.model.response.GoodsInfo; | @@ -10,16 +10,19 @@ import com.yohoufo.order.model.response.GoodsInfo; | ||
10 | */ | 10 | */ |
11 | public class GoodsInfoConvertor { | 11 | public class GoodsInfoConvertor { |
12 | 12 | ||
13 | - public static GoodsInfo SellerOrderGoods2GoodsInfo(SellerOrderGoods sellerOrderGoods) { | 13 | + public static GoodsInfo SellerOrderGoods2GoodsInfo(SellerOrderGoods sog) { |
14 | GoodsInfo goodsInfo = new GoodsInfo(); | 14 | GoodsInfo goodsInfo = new GoodsInfo(); |
15 | - goodsInfo.setSkup(sellerOrderGoods.getId()); | ||
16 | - goodsInfo.setProductName(sellerOrderGoods.getProductName()); | ||
17 | - goodsInfo.setColorName(sellerOrderGoods.getColorName()); | ||
18 | - goodsInfo.setSizeName(sellerOrderGoods.getSizeName()); | ||
19 | - goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | ||
20 | - goodsInfo.setGoodPrice(sellerOrderGoods.getGoodsPrice().toPlainString()); | ||
21 | - goodsInfo.setProductId(sellerOrderGoods.getProductId()); | ||
22 | - goodsInfo.setStorageId(sellerOrderGoods.getStorageId()); | 15 | + goodsInfo.setSkup(sog.getId()); |
16 | + goodsInfo.setProductName(sog.getProductName()); | ||
17 | + goodsInfo.setColorName(sog.getColorName()); | ||
18 | + goodsInfo.setSizeName(sog.getSizeName()); | ||
19 | + goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sog.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | ||
20 | + goodsInfo.setGoodPrice(sog.getGoodsPrice().toPlainString()); | ||
21 | + goodsInfo.setProductId(sog.getProductId()); | ||
22 | + goodsInfo.setStorageId(sog.getStorageId()); | ||
23 | + goodsInfo.setStorageNum(sog.getNum()); | ||
24 | + goodsInfo.setSkupList(sog.getSkupList()); | ||
25 | + goodsInfo.setBatchNo(sog.getBatchNo()); | ||
23 | return goodsInfo; | 26 | return goodsInfo; |
24 | } | 27 | } |
25 | 28 |
@@ -8,6 +8,13 @@ public class GoodsInfo { | @@ -8,6 +8,13 @@ public class GoodsInfo { | ||
8 | 8 | ||
9 | int skup; | 9 | int skup; |
10 | 10 | ||
11 | + /** | ||
12 | + * 批次号 | ||
13 | + */ | ||
14 | + private Long batchNo; | ||
15 | + | ||
16 | + private String skupList; | ||
17 | + | ||
11 | private Integer storageId; | 18 | private Integer storageId; |
12 | private Integer productId; | 19 | private Integer productId; |
13 | /** | 20 | /** |
@@ -32,4 +39,9 @@ public class GoodsInfo { | @@ -32,4 +39,9 @@ public class GoodsInfo { | ||
32 | * 商品价格 | 39 | * 商品价格 |
33 | */ | 40 | */ |
34 | String goodPrice; | 41 | String goodPrice; |
42 | + | ||
43 | + /** | ||
44 | + * 同一个批次的数量 | ||
45 | + */ | ||
46 | + private Integer storageNum; | ||
35 | } | 47 | } |
@@ -7,11 +7,16 @@ import com.yohoufo.common.utils.DateUtil; | @@ -7,11 +7,16 @@ import com.yohoufo.common.utils.DateUtil; | ||
7 | import com.yohoufo.dal.order.BuyerOrderMapper; | 7 | import com.yohoufo.dal.order.BuyerOrderMapper; |
8 | import com.yohoufo.dal.order.OrderCouponMapper; | 8 | import com.yohoufo.dal.order.OrderCouponMapper; |
9 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; | 9 | import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
10 | +import com.yohoufo.dal.order.SellerOrderMapper; | ||
10 | import com.yohoufo.dal.order.model.OrderCoupon; | 11 | import com.yohoufo.dal.order.model.OrderCoupon; |
12 | +import com.yohoufo.dal.order.model.SellerOrder; | ||
11 | import com.yohoufo.dal.order.model.SellerOrderGoods; | 13 | import com.yohoufo.dal.order.model.SellerOrderGoods; |
14 | +import com.yohoufo.order.common.RefundCase; | ||
12 | import com.yohoufo.order.event.BeforeDepotReceiveEvent; | 15 | import com.yohoufo.order.event.BeforeDepotReceiveEvent; |
13 | import com.yohoufo.order.event.BeforeSellerDeliverEvent; | 16 | import com.yohoufo.order.event.BeforeSellerDeliverEvent; |
17 | +import com.yohoufo.order.event.BillLogEvent; | ||
14 | import com.yohoufo.order.model.bo.CouponBo; | 18 | import com.yohoufo.order.model.bo.CouponBo; |
19 | +import com.yohoufo.order.model.request.PaymentRequest; | ||
15 | import com.yohoufo.order.service.IPaymentService; | 20 | import com.yohoufo.order.service.IPaymentService; |
16 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; | 21 | import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
17 | import com.yohoufo.order.service.proxy.CouponProxyService; | 22 | import com.yohoufo.order.service.proxy.CouponProxyService; |
@@ -24,6 +29,7 @@ import org.springframework.stereotype.Service; | @@ -24,6 +29,7 @@ import org.springframework.stereotype.Service; | ||
24 | import org.springframework.web.bind.annotation.RequestParam; | 29 | import org.springframework.web.bind.annotation.RequestParam; |
25 | 30 | ||
26 | import javax.annotation.Resource; | 31 | import javax.annotation.Resource; |
32 | +import java.math.BigDecimal; | ||
27 | import java.util.concurrent.*; | 33 | import java.util.concurrent.*; |
28 | 34 | ||
29 | /** | 35 | /** |
@@ -52,6 +58,11 @@ public class BuyerOrderCancelService { | @@ -52,6 +58,11 @@ public class BuyerOrderCancelService { | ||
52 | private IPaymentService paymentService; | 58 | private IPaymentService paymentService; |
53 | 59 | ||
54 | 60 | ||
61 | + @Autowired | ||
62 | + private SellerOrderMapper sellerOrderMapper; | ||
63 | + | ||
64 | + @Autowired | ||
65 | + private PayRefundService payRefundService; | ||
55 | 66 | ||
56 | 67 | ||
57 | public void cancel(BeforeSellerDeliverEvent bsdEvent){ | 68 | public void cancel(BeforeSellerDeliverEvent bsdEvent){ |
@@ -74,6 +85,18 @@ public class BuyerOrderCancelService { | @@ -74,6 +85,18 @@ public class BuyerOrderCancelService { | ||
74 | 85 | ||
75 | //TODO 整个过程异步去执行(考虑退费依赖订单状态) | 86 | //TODO 整个过程异步去执行(考虑退费依赖订单状态) |
76 | //(退费)退保证金给卖家 | 87 | //(退费)退保证金给卖家 |
88 | + SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode); | ||
89 | + int sellerUid = sellerOrder.getUid(); | ||
90 | + long sellerOrderCode = sellerOrder.getOrderCode(); | ||
91 | + BigDecimal earnestMoney = sellerOrder.getEarnestMoney(); | ||
92 | + PaymentRequest req = PaymentRequest.builder().uid(sellerUid) | ||
93 | + .orderCode(sellerOrderCode).refundAmount(earnestMoney.doubleValue()) | ||
94 | + .build(); | ||
95 | + BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder() | ||
96 | + .buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode()) | ||
97 | + .payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY) | ||
98 | + .skup(skup); | ||
99 | + payRefundService.refund(req, bleb); | ||
77 | 100 | ||
78 | //(转账)瓜分指定赔偿款给卖家和平台 | 101 | //(转账)瓜分指定赔偿款给卖家和平台 |
79 | //(退费)扣除赔偿款,计算剩余的货款,退给买家 | 102 | //(退费)扣除赔偿款,计算剩余的货款,退给买家 |
@@ -103,6 +126,7 @@ public class BuyerOrderCancelService { | @@ -103,6 +126,7 @@ public class BuyerOrderCancelService { | ||
103 | 126 | ||
104 | //TODO 整个过程异步去执行(考虑退费依赖订单状态) | 127 | //TODO 整个过程异步去执行(考虑退费依赖订单状态) |
105 | //(退费)退保证金给卖家 | 128 | //(退费)退保证金给卖家 |
129 | + | ||
106 | //(转账)瓜分指定赔偿款给卖家和平台 | 130 | //(转账)瓜分指定赔偿款给卖家和平台 |
107 | //(退费)扣除赔偿款,计算剩余的货款,退给买家 | 131 | //(退费)扣除赔偿款,计算剩余的货款,退给买家 |
108 | } | 132 | } |
@@ -121,11 +121,21 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | @@ -121,11 +121,21 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I | ||
121 | && OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment(); | 121 | && OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType() == sellerOrder.getPayment(); |
122 | SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON; | 122 | SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON; |
123 | Integer skup = sellerOrder.getSkup(); | 123 | Integer skup = sellerOrder.getSkup(); |
124 | + | ||
125 | + | ||
124 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | 126 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
125 | Integer skupStatusCode = sellerOrderGoods.getStatus(); | 127 | Integer skupStatusCode = sellerOrderGoods.getStatus(); |
128 | + | ||
129 | + SellerOrderGoods sogc = new SellerOrderGoods(); | ||
130 | + sogc.setUid(uid); | ||
131 | + sogc.setGoodsPrice(sellerOrderGoods.getGoodsPrice()); | ||
132 | + sogc.setBatchNo(sellerOrderGoods.getBatchNo()); | ||
133 | + sogc.setStatus(skupStatusCode); | ||
134 | + SellerOrderGoods tsog = sellerOrderGoodsMapper.selectByUidStatusGBBN(sogc); | ||
135 | + | ||
126 | SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode); | 136 | SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode); |
127 | AddressInfo addressInfo = sellerAddressService.getHiddenAddressInfo(uid, skup); | 137 | AddressInfo addressInfo = sellerAddressService.getHiddenAddressInfo(uid, skup); |
128 | - orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, addressInfo, sellerType); | 138 | + orderDetailInfo = buildOrderDetail(sellerOrder, skupStatus, tsog, addressInfo, sellerType); |
129 | }else{ | 139 | }else{ |
130 | orderDetailInfo = super.getOrderDetail(orderRequest); | 140 | orderDetailInfo = super.getOrderDetail(orderRequest); |
131 | } | 141 | } |
-
Please register or login to post a comment