Authored by chenchao

fix refund money

@@ -3,6 +3,7 @@ package com.yohoufo.dal.order; @@ -3,6 +3,7 @@ package com.yohoufo.dal.order;
3 import com.yohoufo.dal.order.model.OrdersPayRefund; 3 import com.yohoufo.dal.order.model.OrdersPayRefund;
4 import org.apache.ibatis.annotations.Param; 4 import org.apache.ibatis.annotations.Param;
5 5
  6 +import java.util.Collection;
6 import java.util.List; 7 import java.util.List;
7 8
8 public interface OrdersPayRefundMapper { 9 public interface OrdersPayRefundMapper {
@@ -14,4 +15,6 @@ public interface OrdersPayRefundMapper { @@ -14,4 +15,6 @@ public interface OrdersPayRefundMapper {
14 15
15 //查看部分退款记录是否存在 -- (新) 16 //查看部分退款记录是否存在 -- (新)
16 OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode); 17 OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode);
  18 +
  19 + List<OrdersPayRefund> selectByRefundCodes(@Param("refundCodes") Collection<String> refundCode);
17 } 20 }
@@ -38,4 +38,14 @@ @@ -38,4 +38,14 @@
38 #{updateTime,jdbcType=INTEGER}, #{refundCode,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}) 38 #{updateTime,jdbcType=INTEGER}, #{refundCode,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER})
39 </insert> 39 </insert>
40 40
  41 + <select id="selectByRefundCodes" resultMap="BaseResultMap" >
  42 + select
  43 + <include refid="Base_Column_List" />
  44 + from orders_pay_refund
  45 + where refund_order_code in
  46 + <foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundOrderCode">
  47 + #{refundCode,jdbcType=VARCHAR}
  48 + </foreach>
  49 + </select>
  50 +
41 </mapper> 51 </mapper>
@@ -16,20 +16,15 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo; @@ -16,20 +16,15 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo;
16 import com.yohobuy.ufo.model.order.vo.ProductVo; 16 import com.yohobuy.ufo.model.order.vo.ProductVo;
17 import com.yohoufo.common.helper.ImageUrlAssist; 17 import com.yohoufo.common.helper.ImageUrlAssist;
18 import com.yohoufo.common.utils.BigDecimalHelper; 18 import com.yohoufo.common.utils.BigDecimalHelper;
19 -import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;  
20 -import com.yohoufo.dal.order.AppraiseOrderMapper;  
21 -import com.yohoufo.dal.order.AppraiseOrderMetaMapper;  
22 -import com.yohoufo.dal.order.AppraiseOrderStorageMapper;  
23 -import com.yohoufo.dal.order.model.AppraiseOrder;  
24 -import com.yohoufo.dal.order.model.AppraiseOrderGoods;  
25 -import com.yohoufo.dal.order.model.AppraiseOrderMeta;  
26 -import com.yohoufo.dal.order.model.AppraiseOrderStorage; 19 +import com.yohoufo.dal.order.*;
  20 +import com.yohoufo.dal.order.model.*;
27 import com.yohoufo.order.constants.MetaKey; 21 import com.yohoufo.order.constants.MetaKey;
28 import com.yohoufo.order.convert.ProductConvertor; 22 import com.yohoufo.order.convert.ProductConvertor;
29 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 23 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
30 import com.yohoufo.order.service.impl.AbsOrderViewService; 24 import com.yohoufo.order.service.impl.AbsOrderViewService;
31 import com.yohoufo.order.utils.LoggerUtils; 25 import com.yohoufo.order.utils.LoggerUtils;
32 import lombok.Builder; 26 import lombok.Builder;
  27 +import org.apache.commons.collections.CollectionUtils;
33 import org.slf4j.Logger; 28 import org.slf4j.Logger;
34 import org.springframework.beans.factory.annotation.Autowired; 29 import org.springframework.beans.factory.annotation.Autowired;
35 import org.springframework.stereotype.Service; 30 import org.springframework.stereotype.Service;
@@ -56,6 +51,9 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -56,6 +51,9 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
56 @Autowired 51 @Autowired
57 private AppraiseOrderMetaMapper appraiseOrderMetaMapper; 52 private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
58 53
  54 + @Autowired
  55 + private OrdersPayRefundMapper ordersPayRefundMapper;
  56 +
59 public PageResp<SellerDepositOrderListResp> getOrderList(SellerDepositOrderListReq req ){ 57 public PageResp<SellerDepositOrderListResp> getOrderList(SellerDepositOrderListReq req ){
60 PageResp.PageRespBuilder<SellerDepositOrderListResp> respBuilder = PageResp.builder(); 58 PageResp.PageRespBuilder<SellerDepositOrderListResp> respBuilder = PageResp.builder();
61 SellerDepositOrderListType sellerDepositOrderListType = SellerDepositOrderListType.getByCode(req.getListType()); 59 SellerDepositOrderListType sellerDepositOrderListType = SellerDepositOrderListType.getByCode(req.getListType());
@@ -136,6 +134,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -136,6 +134,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
136 .build(); 134 .build();
137 } 135 }
138 136
  137 + /**
  138 + * 由子订单维度组成的列表
  139 + * 携带鉴定信息
  140 + * @param req
  141 + * @return
  142 + */
139 public PageResp<DepositOrderInStorePrdListResp> getDepositOrderListInStore(SellerDepositOrderPrdListReq req){ 143 public PageResp<DepositOrderInStorePrdListResp> getDepositOrderListInStore(SellerDepositOrderPrdListReq req){
140 Long orderCode = req.getOrderCode(); 144 Long orderCode = req.getOrderCode();
141 int total = appraiseOrderMapper.selectSubOrderCnt(orderCode); 145 int total = appraiseOrderMapper.selectSubOrderCnt(orderCode);
@@ -148,6 +152,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -148,6 +152,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
148 int offset = (req.getPage() - 1) * limit; 152 int offset = (req.getPage() - 1) * limit;
149 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderList(orderCode, offset, limit); 153 List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderList(orderCode, offset, limit);
150 List<Long> orderCodes = paoList.parallelStream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); 154 List<Long> orderCodes = paoList.parallelStream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
  155 + List<String> orderCodeStrs = paoList.parallelStream().map(ao-> String.valueOf(ao.getOrderCode())).collect(Collectors.toList());
151 // 156 //
152 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); 157 List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes);
153 Map<Long, AppraiseOrderGoods> orderCodeAppraiseOrderGoodsMap = paogList.parallelStream() 158 Map<Long, AppraiseOrderGoods> orderCodeAppraiseOrderGoodsMap = paogList.parallelStream()
@@ -156,9 +161,17 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -156,9 +161,17 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
156 List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodes); 161 List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodes);
157 Map<Long,AppraiseOrderStorage> orderCodeAppraiseOrderStorageMap = paosList.parallelStream() 162 Map<Long,AppraiseOrderStorage> orderCodeAppraiseOrderStorageMap = paosList.parallelStream()
158 .collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, Function.identity())); 163 .collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, Function.identity()));
  164 + //
  165 + List<OrdersPayRefund> ordersPayRefundList = ordersPayRefundMapper.selectByRefundCodes(orderCodeStrs);
  166 + Map<String, OrdersPayRefund> orderCodeStrOPRMap = CollectionUtils.isEmpty(ordersPayRefundList) ?
  167 + new HashMap<>(1) : ordersPayRefundList
  168 + .parallelStream().collect(Collectors.toMap(OrdersPayRefund::getRefundCode, Function.identity()));
  169 +
159 List<DepositOrderInStorePrdListResp> dataList = paoList.parallelStream() 170 List<DepositOrderInStorePrdListResp> dataList = paoList.parallelStream()
160 - .map(pao->buildDepositOrderInStorePrdListResp(pao, orderCodeAppraiseOrderGoodsMap.get(pao.getOrderCode()),  
161 - orderCodeAppraiseOrderStorageMap.get(pao.getOrderCode()))) 171 + .map(pao->buildDepositOrderInStorePrdListResp(pao,
  172 + orderCodeAppraiseOrderGoodsMap.get(pao.getOrderCode()),
  173 + orderCodeAppraiseOrderStorageMap.get(pao.getOrderCode()),
  174 + orderCodeStrOPRMap.get(String.valueOf(pao.getOrderCode()))))
162 .collect(Collectors.toList()); 175 .collect(Collectors.toList());
163 176
164 respBuilder.data(dataList); 177 respBuilder.data(dataList);
@@ -168,11 +181,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -168,11 +181,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
168 181
169 DepositOrderInStorePrdListResp buildDepositOrderInStorePrdListResp(AppraiseOrder pao, 182 DepositOrderInStorePrdListResp buildDepositOrderInStorePrdListResp(AppraiseOrder pao,
170 AppraiseOrderGoods paog, 183 AppraiseOrderGoods paog,
171 - AppraiseOrderStorage paos){ 184 + AppraiseOrderStorage paos,
  185 + OrdersPayRefund ordersPayRefund){
172 186
173 AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus()); 187 AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
174 OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes()); 188 OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes());
175 - String refundEarnestMoney = null; 189 + String refundEarnestMoney = ordersPayRefund == null? null : ordersPayRefund.getAmount().toPlainString();
176 GoodsVo goods = GoodsVo.builder() 190 GoodsVo goods = GoodsVo.builder()
177 .productName(paog.getProductName()) 191 .productName(paog.getProductName())
178 .imgUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU=")) 192 .imgUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU="))
@@ -194,7 +208,11 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -194,7 +208,11 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
194 return OrderAttributes.DEPOSITE; 208 return OrderAttributes.DEPOSITE;
195 } 209 }
196 210
197 - 211 + /**
  212 + * skn 维度商品列表
  213 + * @param req
  214 + * @return
  215 + */
198 public PageResp<ProductVo> getSknList(SellerDepositOrderPrdListReq req){ 216 public PageResp<ProductVo> getSknList(SellerDepositOrderPrdListReq req){
199 Long orderCode = req.getOrderCode(); 217 Long orderCode = req.getOrderCode();
200 int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode); 218 int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
@@ -219,7 +237,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService { @@ -219,7 +237,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
219 .collect(Collectors.toCollection(()->new ArrayList<>(paogs.size()))); 237 .collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
220 } 238 }
221 239
222 - 240 + /**
  241 + * skn维度的商品列表
  242 + * 每一个skn聚合sku列表
  243 + * @param req
  244 + * @return
  245 + */
223 public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){ 246 public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
224 final Long orderCode = req.getOrderCode(); 247 final Long orderCode = req.getOrderCode();
225 int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode); 248 int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);