提交代码

dev
胡锐 6 months ago
parent a1f3409ad8
commit 147f5da9ef
  1. 7
      service/src/main/java/com/hfkj/service/order/OrderCancelService.java
  2. 6
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  3. 6
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java

@ -8,6 +8,7 @@ import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel; import com.hfkj.model.order.OrderModel;
import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.goods.GoodsMsgService; import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -41,7 +42,8 @@ public class OrderCancelService {
private BsOrderCouponService orderCouponService; private BsOrderCouponService orderCouponService;
@Resource @Resource
private GoodsMsgService goodsMsgService; private GoodsMsgService goodsMsgService;
@Resource
private GoodsSpecsService goodsSpecsService;
/** /**
* 订单业务处理 * 订单业务处理
* @param order * @param order
@ -66,6 +68,9 @@ public class OrderCancelService {
if (goodsMsg.getType() == 1) { if (goodsMsg.getType() == 1) {
// 实物 // 实物
} else if (goodsMsg.getType() == 2) { } else if (goodsMsg.getType() == 2) {
// 归库
goodsSpecsService.editStockNum(orderChild.getProductSpecId(), orderChild.getProductCount(), 1);
// 虚拟 // 虚拟
BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(orderChild.getChildOrderNo()); BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(orderChild.getChildOrderNo());
orderCoupon.setCancelTime(new Date()); orderCoupon.setCancelTime(new Date());

@ -78,6 +78,12 @@ public class OrderCreateService {
if (goodsSpecs == null) { if (goodsSpecs == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商品规格"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商品规格");
} }
if (goodsSpecs.getStock() <= 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存不足");
}
// 减少库存
goodsSpecsService.editStockNum(orderChild.getProductSpecId(), orderChild.getProductCount(), 2);
JSONObject businessObj = orderChild.getBusiness()==null?new JSONObject(): new JSONObject((Map<String, Object>) orderChild.getBusiness()); JSONObject businessObj = orderChild.getBusiness()==null?new JSONObject(): new JSONObject((Map<String, Object>) orderChild.getBusiness());
if (businessObj.getLong("shopCartId") != null) { if (businessObj.getLong("shopCartId") != null) {
shoppingCartService.delete(businessObj.getLong("shopCartId")); shoppingCartService.delete(businessObj.getLong("shopCartId"));

@ -61,8 +61,7 @@ public class OrderPaySuccessService {
try { try {
if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
goods(order); goods(order);
} } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
product(order, childOrder); product(order, childOrder);
} }
} catch (Exception e) { } catch (Exception e) {
@ -174,6 +173,9 @@ public class OrderPaySuccessService {
orderCoupon.setPaySerialNo(order.getPaySerialNo()); orderCoupon.setPaySerialNo(order.getPaySerialNo());
orderCouponService.editData(orderCoupon); orderCouponService.editData(orderCoupon);
// 增加销量
goodsMsgService.editSaleNum(childOrder.getProductId(), childOrder.getProductCount(), 1);
// 子订单完成 // 子订单完成
orderService.childOrderComplete(orderCoupon.getChildOrderNo()); orderService.childOrderComplete(orderCoupon.getChildOrderNo());
} }

Loading…
Cancel
Save