提交代码

dev
胡锐 6 months ago
parent e98d76a6dd
commit 6e16e9725d
  1. 26
      order/src/main/java/com/order/controller/business/OrderCouponController.java
  2. 2
      service/src/main/java/com/hfkj/service/coupon/BsOrderCouponNoService.java
  3. 1
      service/src/main/java/com/hfkj/service/order/OrderCancelService.java
  4. 1
      service/src/main/java/com/hfkj/service/order/impl/BsOrderAfterSalesApplyServiceImpl.java
  5. 11
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  6. 8
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java

@ -2,8 +2,13 @@ package com.order.controller.business;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderCoupon;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.BsOrderCouponService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -32,6 +37,27 @@ public class OrderCouponController {
@Resource @Resource
private BsOrderCouponService orderCouponService; private BsOrderCouponService orderCouponService;
@Resource
private BsOrderCouponNoService orderCouponNoService;
@RequestMapping(value="/queryCouNo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询卡密")
public ResponseData queryCouNo(@RequestParam(value = "orderChildNo" , required = true) String orderChildNo) {
try {
// 卡券订单
BsOrderCoupon orderCoupon = orderCouponService.getDetailByChildOrderNo(orderChildNo);
if (orderCoupon == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的卡券订单");
}
return ResponseMsgUtil.success(orderCouponNoService.getListByCouponOrderId(orderCoupon.getId()));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) @RequestMapping(value="/queryDetail",method = RequestMethod.GET)
@ResponseBody @ResponseBody

@ -19,7 +19,7 @@ public interface BsOrderCouponNoService {
/** /**
* 查询列表 * 查询列表
* @param couponOrderNo * @param couponOrderId
* @return * @return
*/ */
List<BsOrderCouponNo> getListByCouponOrderId(Long couponOrderId); List<BsOrderCouponNo> getListByCouponOrderId(Long couponOrderId);

@ -47,6 +47,7 @@ public class OrderCancelService {
* @param order * @param order
* @throws Exception * @throws Exception
*/ */
@Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED)
public void orderBusHandle(OrderModel order) { public void orderBusHandle(OrderModel order) {
for (OrderChildModel childOrder : order.getOrderChildList()) { for (OrderChildModel childOrder : order.getOrderChildList()) {
if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {

@ -201,7 +201,6 @@ public class BsOrderAfterSalesApplyServiceImpl implements BsOrderAfterSalesApply
if (apply == null) { if (apply == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的申请"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的申请");
} }
// 退款 // 退款
BsOrderRefund orderRefund = orderRefundService.tradeOrderChildRefund(apply.getChildOrderNo(), apply.getProductCount(), null); BsOrderRefund orderRefund = orderRefundService.tradeOrderChildRefund(apply.getChildOrderNo(), apply.getProductCount(), null);
if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) { if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) {

@ -22,6 +22,7 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -57,6 +58,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
} }
@Override @Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED)
public boolean refundMoney(BsOrderRefund orderRefund) { public boolean refundMoney(BsOrderRefund orderRefund) {
try { try {
if (OrderPayChannelEnum.type1.getCode() == orderRefund.getRefundPayChannel()) { if (OrderPayChannelEnum.type1.getCode() == orderRefund.getRefundPayChannel()) {
@ -81,7 +83,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
} else if (OrderPayChannelEnum.type3.getCode() ==orderRefund.getRefundPayChannel()) { } else if (OrderPayChannelEnum.type3.getCode() ==orderRefund.getRefundPayChannel()) {
// TODO 暂无该支付方式 // TODO 暂无该支付方式
}*/ else { }*/ else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!未知的支付方式"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!该支付方式暂不支持退款");
} }
} catch (BaseException e) { } catch (BaseException e) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode()); orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
@ -125,13 +127,14 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
} }
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public BsOrderRefund tradeOrderChildRefund(String childOrderNo, Integer productCount, String remark) { public BsOrderRefund tradeOrderChildRefund(String childOrderNo, Integer productCount, String remark) {
// 查询子订单 // 查询子订单
OrderChildModel orderChild = orderChildService.getDetail(childOrderNo); OrderChildModel orderChild = orderChildService.getDetail(childOrderNo);
if (orderChild == null) { if (orderChild == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的子订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的子订单");
} }
if (productCount > orderChild.getProductCount()) { if (productCount > orderChild.getSurplusRefundCount()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!退货数量超过子订单可退数量"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!退货数量超过子订单可退数量");
} }
// 查询交易订单 // 查询交易订单
@ -179,10 +182,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderChild.setSurplusRefundCount(orderChild.getSurplusRefundCount() - productCount); orderChild.setSurplusRefundCount(orderChild.getSurplusRefundCount() - productCount);
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice())); orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice()));
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral()); orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral());
orderChild.setStatus(orderChild.getProductCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus()); orderChild.setStatus(orderChild.getSurplusRefundCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus());
orderChildService.editData(orderChild); orderChildService.editData(orderChild);
} }
return orderRefund; return orderRefund;
} }

@ -180,8 +180,7 @@ public class BsOrderServiceImpl implements BsOrderService {
// 处理业务 // 处理业务
orderPaySuccessHandle(order); orderPaySuccessHandle(order);
} }
// 更新缓存
// 缓存
cache(order); cache(order);
return order; return order;
} }
@ -207,6 +206,8 @@ public class BsOrderServiceImpl implements BsOrderService {
} }
// 取消订单业务 // 取消订单业务
orderCancelService.orderBusHandle(order); orderCancelService.orderBusHandle(order);
// 更新缓存
cache(order);
return order; return order;
} }
@ -220,9 +221,8 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setStatus(OrderChildStatusEnum.status2.getCode()); childOrder.setStatus(OrderChildStatusEnum.status2.getCode());
orderChildService.editData(childOrder); orderChildService.editData(childOrder);
} }
// 缓存 // 更新缓存
cache(order); cache(order);
// 处理业务 // 处理业务
orderPaySuccessService.orderBusHandle(order); orderPaySuccessService.orderBusHandle(order);
} }

Loading…
Cancel
Save