dev-discount
胡锐 2 years ago
parent 6ae301399f
commit 71ce3e468c
  1. 9
      hai-order/src/main/java/com/web/controller/OrderController.java
  2. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  3. 18
      hai-order/src/main/java/com/web/controller/OrderRefundController.java
  4. 2
      hai-order/src/main/java/com/web/controller/TestController.java
  5. 2
      hai-order/src/main/java/com/web/controller/business/OrderOilController.java
  6. 2
      hai-order/src/main/java/com/web/rocketmq/consumer/OrderCancelConsumer.java
  7. 8
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  8. 8
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -20,6 +20,7 @@ import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildGoodsType; import com.hai.order.type.OrderChildGoodsType;
import com.hai.order.type.OrderChildStatus; import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderStatus;
import com.hai.order.utils.OrderUtil; import com.hai.order.utils.OrderUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -132,7 +133,13 @@ public class OrderController {
String orderNo = body.getString("orderNo"); String orderNo = body.getString("orderNo");
String remarks = body.getString("remarks"); String remarks = body.getString("remarks");
return ResponseMsgUtil.success(orderService.cancelOrder(orderNo, remarks));
// 查询订单
HighOrder order = orderService.getOrderDetailByNo(orderNo);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
}
return ResponseMsgUtil.success(orderService.cancelOrder(order, remarks));
} catch (Exception e) { } catch (Exception e) {
log.error("OrderController -> cancel() error!",e); log.error("OrderController -> cancel() error!",e);

@ -55,7 +55,7 @@ import java.util.concurrent.ThreadLocalRandom;
@Controller @Controller
@RequestMapping("/orderPay") @RequestMapping("/orderPay")
@Api(value = "订单支付") @Api(value = "订单支付")
public class OrderPayController { public class OrderPayController {
private static Logger log = LoggerFactory.getLogger(OrderPayController.class); private static Logger log = LoggerFactory.getLogger(OrderPayController.class);

@ -12,6 +12,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund; import com.hai.entity.HighOrderRefund;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel; import com.hai.order.model.CreateOrderChildModel;
@ -21,10 +22,7 @@ import com.hai.order.model.ExportOrderRefundModel;
import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderRefundService;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildGoodsType; import com.hai.order.type.*;
import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundStatus;
import com.hai.order.utils.OrderUtil; import com.hai.order.utils.OrderUtil;
import com.web.config.SysConst; import com.web.config.SysConst;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -72,7 +70,16 @@ public class OrderRefundController {
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
} }
orderService.refundOrder(body.getString("orderNo"), body.getString("remarks")); // 查询订单
HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())
&& !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
}
orderService.refundOrder(order, body.getString("remarks"));
return ResponseMsgUtil.success("退款成功"); return ResponseMsgUtil.success("退款成功");
@ -122,7 +129,6 @@ public class OrderRefundController {
if (userModel == null) { if (userModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, "");
} }
return ResponseMsgUtil.success(orderRefundService.getRefundByRefundNo(refundOrderNo)); return ResponseMsgUtil.success(orderRefundService.getRefundByRefundNo(refundOrderNo));
} catch (Exception e) { } catch (Exception e) {

File diff suppressed because one or more lines are too long

@ -311,7 +311,7 @@ public class OrderOilController {
model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice()); model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice());
model.setDeductionProductPrice(gasOrder.getDeductionProductPrice()); model.setDeductionProductPrice(gasOrder.getDeductionProductPrice());
model.setPayablePrice(gasOrder.getPayablePrice()); model.setPayablePrice(gasOrder.getPayablePrice());
model.setPayGold(gasOrder.getPayGold()/100); model.setPayGold(gasOrder.getPayGold()==null?null:gasOrder.getPayGold()/100);
model.setPayPrice(gasOrder.getPayPrice()!=null?gasOrder.getPayPrice().toString():"未支付"); model.setPayPrice(gasOrder.getPayPrice()!=null?gasOrder.getPayPrice().toString():"未支付");
model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus())); model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus()));
model.setCreateTime(gasOrder.getCreateTime()); model.setCreateTime(gasOrder.getCreateTime());

@ -23,7 +23,7 @@ public class OrderCancelConsumer implements RocketMQListener<HighOrder> {
HighOrder highOrder = orderService.getOrderDetailByNo(order.getOrderNo()); HighOrder highOrder = orderService.getOrderDetailByNo(order.getOrderNo());
if (highOrder != null && highOrder.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { if (highOrder != null && highOrder.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) {
// 取消订单 // 取消订单
orderService.cancelOrder(order.getOrderNo(), null); orderService.cancelOrder(highOrder, null);
} }
} }
} }

@ -38,19 +38,19 @@ public interface OrderService {
/** /**
* 订单取消 * 订单取消
* @param orderNo 订单 * @param order 订单
* @param remarks 备注 * @param remarks 备注
* @return * @return
*/ */
HighOrder cancelOrder(String orderNo,String remarks); HighOrder cancelOrder(HighOrder order,String remarks);
/** /**
* 订单退款 * 订单退款
* @param orderNo * @param order
* @param remarks * @param remarks
* @return * @return
*/ */
HighOrder refundOrder(String orderNo,String remarks) throws Exception; HighOrder refundOrder(HighOrder order,String remarks) throws Exception;
/** /**
* 子订单退款 * 子订单退款

@ -443,8 +443,8 @@ public class OrderServiceImpl implements OrderService {
isolation = Isolation.READ_COMMITTED, isolation = Isolation.READ_COMMITTED,
timeout = 10, timeout = 10,
rollbackFor = Exception.class) rollbackFor = Exception.class)
public HighOrder cancelOrder(String orderNo,String remarks) { @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order")
HighOrder order = getOrderDetailByNo(orderNo); public HighOrder cancelOrder(HighOrder order,String remarks) {
if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
} }
@ -497,8 +497,8 @@ public class OrderServiceImpl implements OrderService {
isolation = Isolation.READ_COMMITTED, isolation = Isolation.READ_COMMITTED,
timeout = 10, timeout = 10,
rollbackFor = Exception.class) rollbackFor = Exception.class)
public HighOrder refundOrder(String orderNo, String remarks) throws Exception { @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order")
HighOrder order = getOrderDetailByNo(orderNo); public HighOrder refundOrder(HighOrder order, String remarks) throws Exception {
if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())
&& !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");

Loading…
Cancel
Save