Authored by chenchao

fix refund money

... ... @@ -3,6 +3,7 @@ package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.OrdersPayRefund;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface OrdersPayRefundMapper {
... ... @@ -14,4 +15,6 @@ public interface OrdersPayRefundMapper {
//查看部分退款记录是否存在 -- (新)
OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode);
List<OrdersPayRefund> selectByRefundCodes(@Param("refundCodes") Collection<String> refundCode);
}
\ No newline at end of file
... ...
... ... @@ -38,4 +38,14 @@
#{updateTime,jdbcType=INTEGER}, #{refundCode,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER})
</insert>
<select id="selectByRefundCodes" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from orders_pay_refund
where refund_order_code in
<foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundOrderCode">
#{refundCode,jdbcType=VARCHAR}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -16,20 +16,15 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo;
import com.yohobuy.ufo.model.order.vo.ProductVo;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
import com.yohoufo.dal.order.AppraiseOrderStorageMapper;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import com.yohoufo.dal.order.model.AppraiseOrderStorage;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.convert.ProductConvertor;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.service.impl.AbsOrderViewService;
import com.yohoufo.order.utils.LoggerUtils;
import lombok.Builder;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -56,6 +51,9 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
@Autowired
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
@Autowired
private OrdersPayRefundMapper ordersPayRefundMapper;
public PageResp<SellerDepositOrderListResp> getOrderList(SellerDepositOrderListReq req ){
PageResp.PageRespBuilder<SellerDepositOrderListResp> respBuilder = PageResp.builder();
SellerDepositOrderListType sellerDepositOrderListType = SellerDepositOrderListType.getByCode(req.getListType());
... ... @@ -136,6 +134,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
.build();
}
/**
* 由子订单维度组成的列表
* 携带鉴定信息
* @param req
* @return
*/
public PageResp<DepositOrderInStorePrdListResp> getDepositOrderListInStore(SellerDepositOrderPrdListReq req){
Long orderCode = req.getOrderCode();
int total = appraiseOrderMapper.selectSubOrderCnt(orderCode);
... ... @@ -148,6 +152,7 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
int offset = (req.getPage() - 1) * limit;
List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderList(orderCode, offset, limit);
List<Long> orderCodes = paoList.parallelStream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
List<String> orderCodeStrs = paoList.parallelStream().map(ao-> String.valueOf(ao.getOrderCode())).collect(Collectors.toList());
//
List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes);
Map<Long, AppraiseOrderGoods> orderCodeAppraiseOrderGoodsMap = paogList.parallelStream()
... ... @@ -156,9 +161,17 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodes);
Map<Long,AppraiseOrderStorage> orderCodeAppraiseOrderStorageMap = paosList.parallelStream()
.collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, Function.identity()));
//
List<OrdersPayRefund> ordersPayRefundList = ordersPayRefundMapper.selectByRefundCodes(orderCodeStrs);
Map<String, OrdersPayRefund> orderCodeStrOPRMap = CollectionUtils.isEmpty(ordersPayRefundList) ?
new HashMap<>(1) : ordersPayRefundList
.parallelStream().collect(Collectors.toMap(OrdersPayRefund::getRefundCode, Function.identity()));
List<DepositOrderInStorePrdListResp> dataList = paoList.parallelStream()
.map(pao->buildDepositOrderInStorePrdListResp(pao, orderCodeAppraiseOrderGoodsMap.get(pao.getOrderCode()),
orderCodeAppraiseOrderStorageMap.get(pao.getOrderCode())))
.map(pao->buildDepositOrderInStorePrdListResp(pao,
orderCodeAppraiseOrderGoodsMap.get(pao.getOrderCode()),
orderCodeAppraiseOrderStorageMap.get(pao.getOrderCode()),
orderCodeStrOPRMap.get(String.valueOf(pao.getOrderCode()))))
.collect(Collectors.toList());
respBuilder.data(dataList);
... ... @@ -168,11 +181,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
DepositOrderInStorePrdListResp buildDepositOrderInStorePrdListResp(AppraiseOrder pao,
AppraiseOrderGoods paog,
AppraiseOrderStorage paos){
AppraiseOrderStorage paos,
OrdersPayRefund ordersPayRefund){
AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes());
String refundEarnestMoney = null;
String refundEarnestMoney = ordersPayRefund == null? null : ordersPayRefund.getAmount().toPlainString();
GoodsVo goods = GoodsVo.builder()
.productName(paog.getProductName())
.imgUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU="))
... ... @@ -194,7 +208,11 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
return OrderAttributes.DEPOSITE;
}
/**
* skn 维度商品列表
* @param req
* @return
*/
public PageResp<ProductVo> getSknList(SellerDepositOrderPrdListReq req){
Long orderCode = req.getOrderCode();
int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
... ... @@ -219,7 +237,12 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
.collect(Collectors.toCollection(()->new ArrayList<>(paogs.size())));
}
/**
* skn维度的商品列表
* 每一个skn聚合sku列表
* @param req
* @return
*/
public PageResp<ProductVo> getSkuList(SellerDepositOrderPrdListReq req){
final Long orderCode = req.getOrderCode();
int total = appraiseOrderGoodsMapper.selectCntByOrderCode(orderCode);
... ...