Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f58e60906a
|
|
@ -16,6 +16,8 @@ import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理
|
* 订单管理
|
||||||
|
|
@ -41,6 +43,11 @@ public class AdminOrderController {
|
||||||
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getOrderById")
|
||||||
|
public CzgResult<Map<String, Object>> getOrderById(Long orderId) {
|
||||||
|
return orderInfoService.getOrderDetails(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/historyOrder")
|
@GetMapping("/historyOrder")
|
||||||
public CzgResult<HistoryOrderVo> historyOrder(
|
public CzgResult<HistoryOrderVo> historyOrder(
|
||||||
@RequestParam(required = false) Long orderId,
|
@RequestParam(required = false) Long orderId,
|
||||||
|
|
@ -59,7 +66,7 @@ public class AdminOrderController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单全额退款 只传订单id
|
* 订单全额退款 只传订单id
|
||||||
* 部分退款 传参refundDetailMap {"详情id":"数量","详情id":"数量"}
|
* 部分退款 传参refundDetail
|
||||||
*/
|
*/
|
||||||
@PostMapping("/refundOrder")
|
@PostMapping("/refundOrder")
|
||||||
public CzgResult<Object> refundOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
|
public CzgResult<Object> refundOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理
|
* 订单管理
|
||||||
|
|
@ -38,6 +40,11 @@ public class UserOrderController {
|
||||||
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getOrderById")
|
||||||
|
public CzgResult<Map<String, Object>> getOrderById(Long orderId) {
|
||||||
|
return orderInfoService.getOrderDetails(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/historyOrder")
|
@GetMapping("/historyOrder")
|
||||||
public CzgResult<HistoryOrderVo> historyOrder(
|
public CzgResult<HistoryOrderVo> historyOrder(
|
||||||
@RequestParam(required = false) Long orderId,
|
@RequestParam(required = false) Long orderId,
|
||||||
|
|
|
||||||
|
|
@ -201,4 +201,8 @@ public class OrderDetail implements Serializable {
|
||||||
public String getRefundRemark() {
|
public String getRefundRemark() {
|
||||||
return StrUtil.isBlank(refundRemark) ? "" : refundRemark + " ";
|
return StrUtil.isBlank(refundRemark) ? "" : refundRemark + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCouponNum() {
|
||||||
|
return couponNum == null ? BigDecimal.ZERO : couponNum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.enums.PayEnums;
|
import com.czg.order.enums.PayEnums;
|
||||||
import com.czg.order.vo.HistoryOrderVo;
|
import com.czg.order.vo.HistoryOrderVo;
|
||||||
import com.czg.order.vo.OrderInfoVo;
|
import com.czg.order.vo.OrderInfoVo;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
@ -30,6 +31,8 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||||
|
|
||||||
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
|
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
|
||||||
|
|
||||||
|
CzgResult<Map<String, Object>> getOrderDetails(Long orderId);
|
||||||
|
|
||||||
HistoryOrderVo historyOrder(Long orderId, String tableCode);
|
HistoryOrderVo historyOrder(Long orderId, String tableCode);
|
||||||
|
|
||||||
OrderInfo createOrder(OrderInfoAddDTO param);
|
OrderInfo createOrder(OrderInfoAddDTO param);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import com.czg.order.service.OrderPaymentService;
|
||||||
import com.czg.order.vo.HistoryOrderVo;
|
import com.czg.order.vo.HistoryOrderVo;
|
||||||
import com.czg.order.vo.OrderDetailSmallVO;
|
import com.czg.order.vo.OrderDetailSmallVO;
|
||||||
import com.czg.order.vo.OrderInfoVo;
|
import com.czg.order.vo.OrderInfoVo;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.order.dto.BigDecimalDTO;
|
import com.czg.order.dto.BigDecimalDTO;
|
||||||
|
|
@ -128,6 +129,18 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
return orderInfoVoPage;
|
return orderInfoVoPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CzgResult<Map<String, Object>> getOrderDetails(Long orderId) {
|
||||||
|
AssertUtil.isNull(orderId, "订单id不能为空");
|
||||||
|
OrderInfo orderInfo = getById(orderId);
|
||||||
|
AssertUtil.isNull(orderInfo, "订单信息不存在");
|
||||||
|
List<OrderDetail> orderDetails = orderDetailService.queryChain().select().eq(OrderDetail::getOrderId, orderId).list();
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("orderInfo", orderInfo);
|
||||||
|
resultMap.put("orderDetails", orderDetails);
|
||||||
|
return CzgResult.success(resultMap);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HistoryOrderVo historyOrder(Long orderId, String tableCode) {
|
public HistoryOrderVo historyOrder(Long orderId, String tableCode) {
|
||||||
if (orderId == null && StrUtil.isBlank(tableCode)) {
|
if (orderId == null && StrUtil.isBlank(tableCode)) {
|
||||||
|
|
@ -212,13 +225,13 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
@Override
|
@Override
|
||||||
public OrderInfo checkOrderPay(CheckOrderPay param) {
|
public OrderInfo checkOrderPay(CheckOrderPay param) {
|
||||||
OrderInfo orderInfo = getById(param.getOrderId());
|
OrderInfo orderInfo = getById(param.getOrderId());
|
||||||
if (!"after-pay".equals(orderInfo.getPayMode())) {
|
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||||
// if (redisService.hasKey(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId())) {
|
// if (redisService.hasKey(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId())) {
|
||||||
// redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId(), "", 60 * 15);
|
// redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + param.getOrderId(), "", 60 * 15);
|
||||||
// } else {
|
// } else {
|
||||||
// throw new ValidateException("订单已过期,请重新下单");
|
// throw new ValidateException("订单已过期,请重新下单");
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
||||||
if (param.isVipPrice() && !shopInfo.getIsMemberPrice().equals(1)) {
|
if (param.isVipPrice() && !shopInfo.getIsMemberPrice().equals(1)) {
|
||||||
|
|
@ -380,9 +393,13 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAllPack) {
|
if (isAllPack) {
|
||||||
|
if ("weigh".equals(orderDetail.getProductType())) {
|
||||||
|
orderDetail.setPackNumber(BigDecimal.ONE);
|
||||||
|
} else {
|
||||||
orderDetail.setPackNumber(orderDetail.getNum());
|
orderDetail.setPackNumber(orderDetail.getNum());
|
||||||
}
|
}
|
||||||
packAmount.setPrice(packAmount.getPrice().add(orderDetail.getPackAmount().multiply(orderDetail.getPackNumber())));
|
}
|
||||||
|
packAmount.setPrice(packAmount.getPrice().add(orderDetail.getPackAmount().multiply(orderDetail.getPackNumber()).setScale(2, RoundingMode.DOWN)));
|
||||||
if (couponNum.compareTo(BigDecimal.ZERO) > 0) {
|
if (couponNum.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
if (couponNum.compareTo(orderDetail.getNum()) >= 0) {
|
if (couponNum.compareTo(orderDetail.getNum()) >= 0) {
|
||||||
orderDetail.setCouponNum(orderDetail.getNum());
|
orderDetail.setCouponNum(orderDetail.getNum());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue