挂账退款bug修复
This commit is contained in:
parent
0bc8095e7c
commit
0e41e455ba
|
|
@ -910,39 +910,39 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
if (!skuIds.isEmpty()) {
|
||||
skuList = productSkuRepository.findAllById(skuIds);
|
||||
}
|
||||
HashMap<String, TbProductSku> skuMap = new HashMap<>();
|
||||
skuList.forEach(item -> skuMap.put(item.getId().toString(), item));
|
||||
HashMap<String, TbProductSku> skuMap = new HashMap<>();
|
||||
skuList.forEach(item -> skuMap.put(item.getId().toString(), item));
|
||||
|
||||
ArrayList<Map<String, Object>> infos = new ArrayList<>();
|
||||
records.forEach(item -> {
|
||||
if (item.getProductId() != null && item.getProductId().equals("-999")) {
|
||||
mealCashierCart.set(item);
|
||||
return;
|
||||
}
|
||||
Map<String, Object> map = BeanUtil.beanToMap(item, false, false);
|
||||
TbProductSku tbProductSku = skuMap.get(item.getSkuId());
|
||||
map.put("specSnap", tbProductSku != null ? tbProductSku.getSpecSnap() : null);
|
||||
map.put("placeNum", item.getPlaceNum() == null ? 0 : item.getPlaceNum());
|
||||
infos.add(map);
|
||||
});
|
||||
ArrayList<Map<String, Object>> infos = new ArrayList<>();
|
||||
records.forEach(item -> {
|
||||
if (item.getProductId() != null && item.getProductId().equals("-999")) {
|
||||
mealCashierCart.set(item);
|
||||
return;
|
||||
}
|
||||
Map<String, Object> map = BeanUtil.beanToMap(item, false, false);
|
||||
TbProductSku tbProductSku = skuMap.get(item.getSkuId());
|
||||
map.put("specSnap", tbProductSku != null ? tbProductSku.getSpecSnap() : null);
|
||||
map.put("placeNum", item.getPlaceNum() == null ? 0 : item.getPlaceNum());
|
||||
infos.add(map);
|
||||
});
|
||||
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page copyPage = BeanUtil.copyProperties(cartPage, com.baomidou.mybatisplus.extension.plugins.pagination.Page.class);
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page copyPage = BeanUtil.copyProperties(cartPage, com.baomidou.mybatisplus.extension.plugins.pagination.Page.class);
|
||||
|
||||
// 根据placeNum进行分组
|
||||
Map<Object, List<Map<String, Object>>> groupedByPlaceNum = infos.stream()
|
||||
.collect(Collectors.groupingBy(info -> info.get("placeNum")));
|
||||
// 根据placeNum进行分组
|
||||
Map<Object, List<Map<String, Object>>> groupedByPlaceNum = infos.stream()
|
||||
.collect(Collectors.groupingBy(info -> info.get("placeNum")));
|
||||
|
||||
ArrayList<HashMap<String, Object>> list = new ArrayList<>();
|
||||
groupedByPlaceNum.forEach((k, v) -> {
|
||||
HashMap<String, Object> item = new HashMap<>();
|
||||
item.put("placeNum", k);
|
||||
item.put("info", v);
|
||||
list.add(item);
|
||||
});
|
||||
copyPage.setRecords(list);
|
||||
Map<String, Object> map = BeanUtil.beanToMap(copyPage, false, false);
|
||||
map.put("seatFee", mealCashierCart);
|
||||
return map;
|
||||
ArrayList<HashMap<String, Object>> list = new ArrayList<>();
|
||||
groupedByPlaceNum.forEach((k, v) -> {
|
||||
HashMap<String, Object> item = new HashMap<>();
|
||||
item.put("placeNum", k);
|
||||
item.put("info", v);
|
||||
list.add(item);
|
||||
});
|
||||
copyPage.setRecords(list);
|
||||
Map<String, Object> map = BeanUtil.beanToMap(copyPage, false, false);
|
||||
map.put("seatFee", mealCashierCart);
|
||||
return map;
|
||||
|
||||
// return BeanUtil.beanToMap(cartPage);
|
||||
}
|
||||
|
|
@ -1514,7 +1514,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
|
||||
private void returnCoupon(TbOrderInfo orderInfo, boolean resetInfo) {
|
||||
// 返还优惠券
|
||||
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) {
|
||||
if (StrUtil.isNotBlank(orderInfo.getCouponInfoList()) && !"null".equals(orderInfo.getCouponInfoList())) {
|
||||
OrderInfoCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderInfoCouponInfoDTO.class);
|
||||
ArrayList<Integer> couponIds = new ArrayList<>();
|
||||
couponInfoDTO.getProductCoupon().forEach(item -> {
|
||||
|
|
@ -2817,7 +2817,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
if (detailList.size() != returnOrderDTO.getOrderDetails().size()) {
|
||||
throw new BadRequestException("挂账退款必须全退");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
detailList = orderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getShopId, returnOrderDTO.getShopId())
|
||||
.eq(TbOrderDetail::getStatus, "closed")
|
||||
|
|
@ -3092,7 +3092,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
} else if ("cash".equals(payType)) {
|
||||
mpOrderDetailService.updateStatusByOrderIdAndIds(OrderStatusEnums.REFUNDING, OrderStatusEnums.REFUND,
|
||||
returnOrderDTO.getOrderId(), returnOrderDTO.getOrderDetails().stream().map(ReturnOrderDTO.OrderDetail::getId).collect(Collectors.toList()));
|
||||
}else if (TableConstant.OrderInfo.PayType.CREDIT_BUYER.equalsVals(payType)) {
|
||||
} else if (TableConstant.OrderInfo.PayType.CREDIT_BUYER.equalsVals(payType)) {
|
||||
creditBuyerOrderService.refund(orderInfo.getCreditBuyerId(), Long.valueOf(orderInfo.getId()));
|
||||
}
|
||||
orderInfo.setStatus(TableConstant.OrderInfo.Status.CLOSED.getValue());
|
||||
|
|
@ -3104,9 +3104,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
.eq(TbOrderDetail::getStatus, TableConstant.OrderInfo.Status.CLOSED));
|
||||
if (count == 0) {
|
||||
returnCoupon(orderInfo, true);
|
||||
// 返还积分
|
||||
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(),
|
||||
"用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
||||
if (orderInfo.getMemberId() != null && orderInfo.getPointsNum() != null) {
|
||||
// 返还积分
|
||||
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(),
|
||||
"用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
orderInfoMapper.updateById(orderInfo);
|
||||
|
|
|
|||
Loading…
Reference in New Issue