李天标 2 anni fa
parent
commit
6b5c348cb2

+ 1 - 1
src/main/java/com/szwl/aspect/MyWebMvcConfigurer.java

@@ -21,7 +21,7 @@ public class MyWebMvcConfigurer extends WebMvcConfigurationSupport {
         // 自定义去除的路径
         String[] myExcludes= {"/tAdmin/login","/tAdmin/save","/tAdmin/updatePassword","/tMessageCode/**","/tJoinpayMch/**","/tLogo/**",
                 "/tProportion/**","/tProduct/**","/tPromoCode/**", "/tProportionCheck/**", "/tProduct/selectProductList",  "/rabbitMqController/**","/tJoinpayMchCheck/**","/indexController/**","/sysRoleMenu/**",
-                "/tEquipmentApply/**","/tEquipment/**","/api/**","/tAdmin/**","/tNotice/**","/tParameters/**",
+                "/tEquipmentApply/**","/tEquipment/**","/api/**","/tOrder/**","/tNotice/**","/tParameters/**",
                 "/tLabel/**","/tArea/**","/error"};
         registry.addInterceptor(headTokenInterceptor).addPathPatterns("/**")
                 // swagger

+ 18 - 2
src/main/java/com/szwl/controller/TOrderController.java

@@ -139,6 +139,7 @@ public class TOrderController {
 //                altRefInfo.add(refInfo);
 //            }
 //        }
+        BigDecimal p8_MarketRefAmount = BigDecimal.ZERO;
         for (int i = 0; i < altInfoArray.size(); i++) {
             JSONObject altInfoObject = altInfoArray.getJSONObject(i);
 
@@ -160,6 +161,9 @@ public class TOrderController {
                 altAmountPrice = refusePrice.multiply(altAmountPrice.divide(sumPrice,2,BigDecimal.ROUND_HALF_UP)).setScale(2, RoundingMode.HALF_DOWN);
                 p = p.add(altAmountPrice);
                 refInfo.put("altRefAmount", altAmountPrice.toString());
+                if(order.getMarketingAmount()!=null){
+                    p8_MarketRefAmount = order.getMarketingAmount().multiply(refusePrice.divide(sumPrice,2,BigDecimal.ROUND_HALF_UP)).setScale(2, RoundingMode.HALF_DOWN);
+                }
             }else {
                 //退全部的钱
 //                if(order.getRefundAmount()!=null){
@@ -176,6 +180,9 @@ public class TOrderController {
                 altAmountPrice = refusePrice.multiply(divide).setScale(2, RoundingMode.HALF_DOWN);
                 p = p.add(altAmountPrice);
                 refInfo.put("altRefAmount", altAmountPrice.toString());
+                if(order.getMarketingAmount()!=null){
+                    p8_MarketRefAmount = order.getMarketingAmount().multiply(refusePrice.divide(sumPrice,2,BigDecimal.ROUND_HALF_UP)).setScale(2, RoundingMode.HALF_DOWN);
+                }
 
             }
 
@@ -197,7 +204,7 @@ public class TOrderController {
             altRefInfo.add(refInfo);
         }
         String text = "";
-        BigDecimal p8_MarketRefAmount = order.getMarketingAmount().multiply(refusePrice.divide(sumPrice,2,BigDecimal.ROUND_HALF_UP)).setScale(2, RoundingMode.HALF_DOWN);
+
         //需要知道订单是哪一个平台的,不能以账号的为标准  0或null为汇聚,1为杉德支付
         String payPlatform = order.getPayPlatform();
         if (StringUtils.isNotEmpty(payPlatform) && payPlatform.equals("1")) {
@@ -358,9 +365,18 @@ public class TOrderController {
             }
         } else {
             try {
-                String result = orderService.refund(order.getSn(), orderService.initRefundSn(equipmentId), refusePrice, p8_MarketRefAmount,"", notifyUrl, altRefInfo.toString());
+                String result = orderService.refund(order.getSn(), orderService.initRefundSn(equipmentId), refusePrice.subtract(p8_MarketRefAmount), p8_MarketRefAmount,"", notifyUrl, altRefInfo.toString());
                 if ("退款申请成功".equals(result)) {
                     order.setStatus(2);
+                    if(StringUtils.isNotEmpty(order.getCoupons())){
+                        //设置退款营销金额
+                        if(order.getRefundMarketingAmount()!=null){
+                            //累加
+                            order.setRefundMarketingAmount(order.getRefundMarketingAmount().add(p8_MarketRefAmount));
+                        }else {
+                            order.setRefundMarketingAmount(p8_MarketRefAmount);
+                        }
+                    }
                     order.setRefundTrxNo(String.valueOf(torder.getRefundAmount()));
                     payFeign.updateOrder(order);
                     return ResponseEntity

+ 2 - 0
src/main/java/com/szwl/model/entity/TOrder.java

@@ -119,5 +119,7 @@ public class TOrder implements Serializable {
 
     private BigDecimal marketingAmount;
 
+    private BigDecimal refundMarketingAmount;
+
     private String coupons;
 }