Merge branch 'refs/heads/dev' into test

This commit is contained in:
张松
2024-12-17 15:00:19 +08:00
2 changed files with 11 additions and 6 deletions

View File

@@ -139,7 +139,6 @@ public class OrderController {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userId = jsonObject.getString("accountId");
orderVo.setMerchantId(Integer.valueOf(userId));
orderVo.setUserId(jsonObject.getString("staffId"));
return orderService.createOrder(orderVo, clientType, token, null, true);
}

View File

@@ -941,6 +941,7 @@ public class PayService {
orderInfo.setStatus("closed");
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
orderInfo.setMemberId(vipUserId.toString());
orderInfo.setUserId(shopUser.getUserId());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
//更新购物车状态
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, orderInfo.getId());
@@ -1252,7 +1253,7 @@ public class PayService {
hasNormalReturn = true;
saleAmount = saleAmount.add(orderDetail.getPrice());
if (remainNum.compareTo(BigDecimal.ZERO) <= 0) {
returnAmount = orderDetail.getPriceAmount();
returnAmount = returnAmount.add(orderDetail.getPriceAmount());
packAMount = orderDetail.getPackAmount();
} else {
currentDetailAMount = orderDetail.getPriceAmount()
@@ -1297,7 +1298,7 @@ public class PayService {
throw new MsgException("退款金额必须大于0");
}
oldOrderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO));
oldOrderInfo.setCouponInfoList(couponInfoDTO == null ? null : JSONObject.toJSONString(couponInfoDTO));
// 保存剩余未退款的订单详情
if (!remainOrderDetailList.isEmpty()) {
@@ -1325,6 +1326,9 @@ public class PayService {
returnOrder.setPayAmount(returnAmount);
mPOrderInfoMapper.insert(returnOrder);
for (TbOrderDetail orderDetail : detailList) {
orderDetail.setOrderId(returnOrder.getId());
}
updateStockAndRecord(detailList);
mpOrderDetailService.updateBatchById(detailList);
@@ -1399,7 +1403,7 @@ public class PayService {
}
@Transactional
@Transactional(rollbackFor = Exception.class)
public Object returnOrder(ReturnOrderDTO returnOrderDTO) {
TbOrderInfo orderInfo = mPOrderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
.eq(TbOrderInfo::getId, returnOrderDTO.getOrderId())
@@ -1500,8 +1504,10 @@ public class PayService {
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 && orderInfo.getPointsNum() > 0) {
memberPointsService.addPoints(Long.valueOf(orderInfo.getMemberId()), orderInfo.getPointsNum(),
"用户退款订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
}
}
}
mPOrderInfoMapper.updateById(orderInfo);