浏览代码

bugfix-呵呵支付

Aslee 3 年之前
父节点
当前提交
fdc29ccc1e

+ 1 - 1
src/main/java/com/caimei/controller/HeliPayApi.java

@@ -89,7 +89,7 @@ public class HeliPayApi {
      */
     @ApiOperation("合利宝微信小程序/公众号支付")
     @PostMapping("/online")
-    public ResponseJson<JSONObject> payOnline(HeliDto heliDto, @RequestHeader HttpHeaders headers) {
+    public ResponseJson<JSONObject> payOnline(@RequestBody HeliDto heliDto, @RequestHeader HttpHeaders headers) {
         if (null == heliDto.getShopOrderId()) {
             return ResponseJson.error("子订单Id不能为空!", null);
         }

+ 13 - 5
src/main/java/com/caimei/service/impl/OrderSubmitServiceImpl.java

@@ -464,6 +464,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         AtomicReference<BigDecimal> totalBrokerage = new AtomicReference<>(BigDecimal.ZERO);
         shopOrderList.forEach(shopOrder-> totalBrokerage.set(MathUtil.add(totalBrokerage, shopOrder.getBrokerage())));
         shopOrderList.sort((o1, o2) -> o2.getBrokerage().compareTo(o1.getBrokerage()));
+        log.info(">>>>>>>>>>>>>>>分摊前总佣金:" + totalBrokerage);
         // 前面子订单的分摊优惠总和
         AtomicDouble allReduction = new AtomicDouble(0);
         if (MathUtil.compare(allDiscount, BigDecimal.ZERO) > 0) {
@@ -476,17 +477,18 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
                     //子订单真实支付金额
                     double realPay = MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue();
                     shopOrderList.get(i).setRealPay(realPay);
-                    allReduction.set(MathUtil.add(v, allReduction.get()).doubleValue());
+                    allReduction.set(MathUtil.add(discount, allReduction.get()).doubleValue());
                 }
                 if (i == shopOrderList.size() - 1) {
                     //最后一个子订单的分摊优惠金额=全优惠allDiscount-已分摊
                     double discount = MathUtil.sub(allDiscount, allReduction.get()).doubleValue();
                     shopOrderList.get(i).setEachDiscount(discount);
-                    shopOrderList.get(i).setRealPay(MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue());
+                    double realPay = MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue();
+                    shopOrderList.get(i).setRealPay(realPay);
                 }
                 //有优惠金额,最高手续费=支付金额*0.65%>10取0.65,不大于取10(合利宝最高0.65%)
                 double realPay = shopOrderList.get(i).getRealPay();
-                double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+                double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue();
                 //佣金>最高手续费可以线上,否则线下
                 double bro = MathUtil.sub(realPay, shopOrderList.get(i).getShouldPayShopAmount()).doubleValue();
                 if (bro < charge) {
@@ -497,7 +499,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
             //无优惠金额
             shopOrderList.forEach(so -> {
                 BigDecimal realPay = so.getNeedPayAmount();
-                BigDecimal charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2) : new BigDecimal(10);
+                BigDecimal charge = MathUtil.mul(realPay, 0.0065, 2);
                 BigDecimal bro = so.getBrokerage();
                 so.setRealPay(realPay.doubleValue());
                 so.setEachDiscount(0d);
@@ -510,7 +512,13 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
         if (!onlinePay.get()) {
             //设置手动回滚事务
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return ResponseJson.success("抱歉,部分商品支付正在调整,暂不支持下单", null);
+            String msg = "";
+            if (productCount > 1) {
+                msg = "抱歉,部分商品支付正在调整,暂不支持下单";
+            } else {
+                msg = "抱歉,该商品支付正在调整,暂不支持下单";
+            }
+            return ResponseJson.error(-1,msg, null);
         }
 
         for (int i = 0; i < shopOrderList.size(); i++) {

+ 1 - 1
src/main/resources/config/beta/application-beta.yml

@@ -43,7 +43,7 @@ wx:
 caimei:
   oldapi: https://www-b.caimei365.com
   #支付异步回调地址
-  notifyUrl: https://mall2c-b.caimei365.com/PayOrder/paymentCallback
+  notifyUrl: https://mall2c-b.caimei365.com/order/pay/callback
   #支付链接重定向地址
   redirectLink: https://mall2c-b.caimei365.com/PayOrder/jumpPage
   #微服务网关地址

+ 1 - 1
src/main/resources/config/dev/application-dev.yml

@@ -42,7 +42,7 @@ wx:
 caimei:
   oldapi: http://localhost:8100
   #支付异步回调地址
-  notifyUrl: https://mall2c-b.caimei365.com/PayOrder/paymentCallback
+  notifyUrl: https://mall2c-b.caimei365.com/order/pay/callback
   #支付链接重定向地址
   redirectLink: https://mall2c-b.caimei365.com/PayOrder/jumpPage
   #微服务网关地址

+ 1 - 1
src/main/resources/config/prod/application-prod.yml

@@ -44,7 +44,7 @@ wx:
 caimei:
   oldapi: https://www.caimei365.com
   #支付异步回调地址
-  notifyUrl: https://mall2c.caimei365.com/PayOrder/paymentCallback
+  notifyUrl: https://mall2c.caimei365.com/order/pay/callback
   #支付链接重定向地址
   redirectLink: https://mall2c.caimei365.com/PayOrder/jumpPage
   #微服务网关地址

+ 1 - 0
src/main/resources/mapper/ProductMapper.xml

@@ -85,6 +85,7 @@
           AND NOW() BETWEEN cha.beginTime
             AND cha.endTime
           AND a.productId = #{productId}
+        limit 1
     </select>
 
     <select id="findActivityLadder" resultType="com.caimei.model.vo.ActivityLadderVo">