From 57fb4be4d2b2253191b41bb15d90e8f28eae1b52 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Thu, 1 Jun 2023 14:24:12 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=9E=E7=89=A9=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hai-service/pom.xml | 6 ++++
.../main/java/com/hai/entity/HighOrder.java | 33 ++++++++++++++++++-
.../model/combine/CombineOrderModel.java | 4 +++
.../com/hai/order/service/OrderService.java | 4 +++
.../order/service/impl/OrderServiceImpl.java | 10 ++++--
.../hai/service/OutRechargeOrderService.java | 2 ++
.../impl/OutRechargeOrderServiceImpl.java | 28 ++++++++++++++++
.../src/main/java/com/hai/wxPay/WxConfig.java | 6 ++++
8 files changed, 90 insertions(+), 3 deletions(-)
create mode 100644 hai-service/src/main/java/com/hai/order/model/combine/CombineOrderModel.java
create mode 100644 hai-service/src/main/java/com/hai/wxPay/WxConfig.java
diff --git a/hai-service/pom.xml b/hai-service/pom.xml
index 613f8523..e080c043 100644
--- a/hai-service/pom.xml
+++ b/hai-service/pom.xml
@@ -345,6 +345,12 @@
junit
junit
+
+
+ com.github.wechatpay-apiv3
+ wechatpay-apache-httpclient
+ 0.4.9
+
org.springframework
spring-test
diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java
index 5c6e78b0..0953bfcd 100644
--- a/hai-service/src/main/java/com/hai/entity/HighOrder.java
+++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java
@@ -3,6 +3,7 @@ package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
/**
* high_order
@@ -276,8 +277,38 @@ public class HighOrder implements Serializable {
*/
private String ext6;
+ private String time;
+
+ private String goodsTypeName;
+
+ public String getGoodsTypeName() {
+ return goodsTypeName;
+ }
+
+ public void setGoodsTypeName(String goodsTypeName) {
+ this.goodsTypeName = goodsTypeName;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
private static final long serialVersionUID = 1L;
+ private List highChildOrderList;
+
+ public List getHighChildOrderList() {
+ return highChildOrderList;
+ }
+
+ public void setHighChildOrderList(List highChildOrderList) {
+ this.highChildOrderList = highChildOrderList;
+ }
+
public Long getId() {
return id;
}
@@ -892,4 +923,4 @@ public class HighOrder implements Serializable {
sb.append("]");
return sb.toString();
}
-}
\ No newline at end of file
+}
diff --git a/hai-service/src/main/java/com/hai/order/model/combine/CombineOrderModel.java b/hai-service/src/main/java/com/hai/order/model/combine/CombineOrderModel.java
new file mode 100644
index 00000000..783854af
--- /dev/null
+++ b/hai-service/src/main/java/com/hai/order/model/combine/CombineOrderModel.java
@@ -0,0 +1,4 @@
+package com.hai.order.model.combine;
+
+public class CombineOrderModel {
+}
diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java
index 12f6df6d..0ddf6f3a 100644
--- a/hai-service/src/main/java/com/hai/order/service/OrderService.java
+++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java
@@ -1,5 +1,6 @@
package com.hai.order.service;
+import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.order.model.CreateOrderModel;
@@ -36,6 +37,9 @@ public interface OrderService {
*/
HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception;
+ JSONObject createOrderCombine(CreateOrderModel createOrderModel) throws Exception;
+
+
/**
* 订单取消
* @param order 订单
diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
index c5e6e3ab..a511bf9a 100644
--- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
@@ -494,14 +494,14 @@ public class OrderServiceImpl implements OrderService {
}
- order.setSurplusRefundPrice(new BigDecimal("0"));
+ order.setSurplusRefundPrice(new BigDecimal("0") );
order.setSurplusRefundIntegral(0);
order.setSearchTitle(order.getOrderNo());
// 订单入库前处理
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setOrderNo(order.getOrderNo());
- childOrder.setSurplusRefundNum(childOrder.getSaleCount());
+ childOrder.setSurplusRefundNum(childOrder.getSaleCount()) ;
// 计算 子订单 在交易订单金额中的占比
BigDecimal ratio = childOrder.getGoodsPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2);
@@ -541,6 +541,12 @@ public class OrderServiceImpl implements OrderService {
return orderData;
}
+
+ @Override
+ public JSONObject createOrderCombine(CreateOrderModel createOrderModel) throws Exception {
+ return null;
+ }
+
@Override
@Transactional(
propagation= Propagation.REQUIRES_NEW,
diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
index 1a834c3c..475a1cbb 100644
--- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
+++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
@@ -212,4 +212,6 @@ public interface OutRechargeOrderService {
OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder);
JSONObject prepaidRechargeOrderHandle(JSONObject object);
+
+ boolean rechargeOrderAbnormal(OutRechargeOrder order);
}
diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
index 2667ea36..e23e3151 100644
--- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
+++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
@@ -92,6 +92,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Autowired
private OutRechargeChildOrderService childOrderService;
+ @Resource
+ private SecConfigService secConfigService;
+
@Override
public List getListRechargeOrder(Map map) {
OutRechargeOrderExample example = new OutRechargeOrderExample();
@@ -406,6 +409,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
String key = "recharge_" + outRechargeOrder.getId();
+ if (outRechargeOrderService.rechargeOrderAbnormal(outRechargeOrder)) {
+ return;
+ }
+
try {
// 分布式锁占坑
@@ -547,6 +554,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Override
public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) {
+ if (rechargeOrderAbnormal(outRechargeOrder)) {
+ return;
+ }
+
JSONObject object = new JSONObject();
object.put("rechargePrice" , outRechargeOrder.getRechargePrice());
object.put("rechargeMobile" , outRechargeOrder.getRechargeContent());
@@ -989,4 +1000,21 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
return childOrder;
}
+
+ @Override
+ public boolean rechargeOrderAbnormal(OutRechargeOrder order) {
+
+ HighOrder highOrder = highOrderService.getOrderByOrderNo(order.getOrderNo());
+
+ if (secConfigService.isConfig("RECHARGE_ORDER" , order.getRechargeContent())) {
+ highOrder.setExceptionStatus(true);
+ highOrder.setExceptionContent("当前订单存在以前多充值!");
+ order.setRechargeStatus(204);
+ orderService.updateOrderData(highOrder);
+ outRechargeOrderMapper.updateByPrimaryKey(order);
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/hai-service/src/main/java/com/hai/wxPay/WxConfig.java b/hai-service/src/main/java/com/hai/wxPay/WxConfig.java
new file mode 100644
index 00000000..53222f78
--- /dev/null
+++ b/hai-service/src/main/java/com/hai/wxPay/WxConfig.java
@@ -0,0 +1,6 @@
+package com.hai.wxPay;
+
+public class WxConfig {
+
+
+}