From db689e5e2cb730b2cf08796fa224084f00758a71 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期六, 12 三月 2022 17:05:17 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java b/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
index 8a40ac4..cf92855 100755
--- a/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
+++ b/service-fee/src/main/java/com/java110/fee/api/ApplyRoomDiscountApi.java
@@ -5,14 +5,10 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.DataFlowContext;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.dto.account.AccountDto;
-import com.java110.dto.accountDetail.AccountDetailDto;
 import com.java110.dto.applyRoomDiscount.ApplyRoomDiscountDto;
 import com.java110.dto.applyRoomDiscountType.ApplyRoomDiscountTypeDto;
 import com.java110.dto.fee.FeeDetailDto;
 import com.java110.dto.feeDiscount.FeeDiscountRuleDto;
-import com.java110.dto.owner.OwnerRoomRelDto;
 import com.java110.fee.bmo.account.ISaveAccountBMO;
 import com.java110.fee.bmo.account.IUpdateAccountBMO;
 import com.java110.fee.bmo.applyRoomDiscount.IAuditApplyRoomDiscountBMO;
@@ -34,10 +30,14 @@
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.StringUtil;
-import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
@@ -49,6 +49,8 @@
 @RestController
 @RequestMapping(value = "/applyRoomDiscount")
 public class ApplyRoomDiscountApi {
+
+    private static final String SPEC_RATE = "89002020980013"; // 鎵撴姌鐜�
 
     @Autowired
     private ISaveApplyRoomDiscountBMO saveApplyRoomDiscountBMOImpl;
@@ -250,7 +252,8 @@
                 //鑾峰彇鎶樻墸绫诲瀷(1: 鎵撴姌  2:鍑忓厤  3:婊炵撼閲�  4:绌虹疆鎴挎墦鎶�  5:绌虹疆鎴垮噺鍏�)
                 String discountSmallType = feeDiscountRuleDtos.get(0).getDiscountSmallType();
                 //鑾峰彇瑙勫垯
-                String specValue = feeDiscountSpecs.getJSONObject(1).getString("specValue");
+                //String specValue = feeDiscountSpecs.getJSONObject(1).getString("specValue");
+                String specValue = getRateSpecValueByFeeDiscountSpecs(feeDiscountSpecs);
                 if (!StringUtil.isEmpty(discountSmallType) && (discountSmallType.equals("1") || discountSmallType.equals("4"))) { //鎵撴姌
                     for (int index = 0; index < feeDetailIds.size(); index++) {
                         String feeDetailId = String.valueOf(feeDetailIds.get(index));
@@ -294,6 +297,46 @@
     }
 
     /**
+     * 89002020980001	102020001	鏈堜唤
+     * 89002020980002	102020001	鎵撴姌鐜�
+     * 89002020980003	102020002	鏈堜唤
+     * 89002020980004	102020002	鍑忓厤閲戦
+     * 89002020980005	102020003	婊炵撼閲�
+     * 89002020980006	102020004	婊炵撼閲�
+     * 89002020980007	102020005	鏈堜唤
+     * 89002020980008	102020005	鎵撴姌鐜�
+     * 89002020980009	102020005	娆犺垂鏃堕暱
+     * 89002020980010	102020006	鏈堜唤
+     * 89002020980011	102020006	鍑忓厤閲戦
+     * 89002020980012	102020007	鏈堜唤
+     * 89002020980013	102020007	鎵撴姌鐜�
+     * @param feeDiscountSpecs
+     * @return
+     */
+    private String getRateSpecValueByFeeDiscountSpecs(JSONArray feeDiscountSpecs) {
+
+        for (int specIndex = 0; specIndex < feeDiscountSpecs.size(); specIndex++) {
+            if (SPEC_RATE.equals(feeDiscountSpecs.getJSONObject(specIndex).getString("specId"))) {
+                return feeDiscountSpecs.getJSONObject(specIndex).getString("specValue");
+            }
+            if ("89002020980002".equals(feeDiscountSpecs.getJSONObject(specIndex).getString("specId"))) {
+                return feeDiscountSpecs.getJSONObject(specIndex).getString("specValue");
+            }
+            if ("89002020980004".equals(feeDiscountSpecs.getJSONObject(specIndex).getString("specId"))) {
+                return feeDiscountSpecs.getJSONObject(specIndex).getString("specValue");
+            }
+            if ("89002020980008".equals(feeDiscountSpecs.getJSONObject(specIndex).getString("specId"))) {
+                return feeDiscountSpecs.getJSONObject(specIndex).getString("specValue");
+            }
+            if ("89002020980011".equals(feeDiscountSpecs.getJSONObject(specIndex).getString("specId"))) {
+                return feeDiscountSpecs.getJSONObject(specIndex).getString("specValue");
+            }
+        }
+
+        throw new IllegalArgumentException("鏈壘鍒� 鎵撴姌绯绘暟");
+    }
+
+    /**
      * 楠屾埧鎺ュ彛
      *
      * @param reqJson

--
Gitblit v1.8.0