From 5a6015d1558f93d62de54adfd471faa361a7165d Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 25 九月 2020 12:20:59 +0800
Subject: [PATCH] 优化代码

---
 service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToPaySMOImpl.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToPaySMOImpl.java b/service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToPaySMOImpl.java
index e32df85..0c4f977 100644
--- a/service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToPaySMOImpl.java
+++ b/service-front/src/main/java/com/java110/front/smo/payment/impl/RentingToPaySMOImpl.java
@@ -6,6 +6,7 @@
 import com.java110.core.context.PageData;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.dto.rentingConfig.RentingConfigDto;
 import com.java110.dto.rentingPool.RentingPoolDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.front.properties.WechatAuthProperties;
@@ -104,18 +105,24 @@
         if (RentingPoolDto.STATE_TO_PAY.equals(rentingPoolDto.getState())) {
             rate = Double.parseDouble(rentingPoolDto.getServiceTenantRate());
             feeName += "(绉熷)";
-        } else if (RentingPoolDto.STATE_TO_PAY.equals(rentingPoolDto.getState())) {
+        } else if (RentingPoolDto.STATE_OWNER_TO_PAY.equals(rentingPoolDto.getState())) {
             rate = Double.parseDouble(rentingPoolDto.getServiceOwnerRate());
             feeName += "(涓氫富)";
         } else {
             throw new IllegalAccessException("褰撳墠鐘舵�佷笉鏄敮浠樼姸鎬�");
         }
-
+        String rentingFormula = rentingPoolDto.getRentingFormula();
         BigDecimal serviceDec = new BigDecimal(service);
         BigDecimal rateDec = new BigDecimal(rate);
-        double money = serviceDec.multiply(rateDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        double money = 0.0;
+        if (RentingConfigDto.RENTING_FORMULA_RATE.equals(rentingFormula)) {
+            BigDecimal monthMoney = new BigDecimal(rentingPoolDto.getPrice());
+            money = serviceDec.multiply(rateDec).multiply(monthMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        } else {
+            money = serviceDec.multiply(rateDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+        }
 
-        Map result = super.java110Payment(outRestTemplate, feeName, WechatAuthProperties.TRADE_TYPE_NATIVE, orderId, money, "", smallWeChatDto);
+        Map result = super.java110Payment(outRestTemplate, feeName, WechatAuthProperties.TRADE_TYPE_NATIVE, orderId, money, "", smallWeChatDto, wechatAuthProperties.getRentingNotifyUrl());
         result.put("money", money);
         responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
         if (!"0".equals(result.get("code"))) {

--
Gitblit v1.8.0