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 { + + +}