From 4e992596dd378bb68021875a90801b4c7ecaf288 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 06 十二月 2024 00:52:07 +0800
Subject: [PATCH] 扣款只扣物业费和水电费扣款

---
 service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java                           |  219 +++++--------------------------------------
 service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java     |   36 +++---
 service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java     |   28 +++--
 java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java                           |    1 
 service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java |    5 
 5 files changed, 71 insertions(+), 218 deletions(-)

diff --git a/java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java b/java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java
index 4ba5562..0f3cc77 100755
--- a/java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java
+++ b/java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java
@@ -25,6 +25,7 @@
     public static final String CUSTOME_FEE_CONFIG = "F";
 
     public static final String FEE_TYPE_CD_WATER = "888800010016";//鐢佃垂
+    public static final String FEE_TYPE_CD_PROPERTY = "888800010001";//鐗╀笟璐�
     public static final String FEE_TYPE_CD_METER = "888800010015";//姘磋垂
     public static final String FEE_TYPE_CD_GAS = "888800010009";//鐓ゆ皵
     public static final String FEE_TYPE_CD_SYSTEM = "888800010000";//绯荤粺
diff --git a/service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java
index ff9a9bd..d52af77 100644
--- a/service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java
+++ b/service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java
@@ -20,6 +20,7 @@
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -115,7 +116,9 @@
             OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
             ownerRoomRelDto.setRoomId(payerObjId);
             List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-            Assert.listOnlyOne(ownerRoomRelDtos, "鏌ヨ涓氫富鎴垮眿鍏崇郴琛ㄩ敊璇紒");
+            if(ListUtil.isNull(ownerRoomRelDtos)){
+                throw new CmdException("鎴垮眿鏈粦瀹氫笟涓诲叧绯�");
+            }
             ownerId = ownerRoomRelDtos.get(0).getOwnerId();
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(payerObjType)) {
             OwnerCarDto ownerCarDto = new OwnerCarDto();
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
index c047bb4..796bbd4 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
@@ -250,29 +250,13 @@
             payFeeDetailPo.setCashierId(userDtos.get(0).getUserId());
             payFeeDetailPo.setCashierName(userDtos.get(0).getName());
             payFeeDetailPo.setOpenInvoice("N");
-            if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
-                BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-                BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-                if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
-                    payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
-                } else {
-                    payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
-                }
-            }
-            if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
+
+            if (!StringUtil.isEmpty(paramObj.getString("cashAmount"))) {
                 BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
                 if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
                     payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
                 } else {
                     payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
-                }
-            }
-            if (StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
-                BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-                if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
-                    payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
-                } else {
-                    payFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
                 }
             }
             int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(payFeeDetailPo);
@@ -332,94 +316,34 @@
             return;
         }
 
-        BigDecimal integralSum = new BigDecimal(0);
         BigDecimal cashSum = new BigDecimal(0);
 
         for (int columnIndex = 0; columnIndex < jsonArray.size(); columnIndex++) {
             JSONObject param = jsonArray.getJSONObject(columnIndex);
             //璐︽埛閲戦
             BigDecimal amount = new BigDecimal(param.getString("amount"));
-            if ("2004".equals(param.getString("acctType"))) { //绉垎璐︽埛
-                //鑾峰彇鏈�澶ф姷鎵gН鍒�
-                BigDecimal maximumNumber = new BigDecimal(param.getString("maximumNumber"));
-                //鑾峰彇绉垎鎶垫墸
-                BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
-                int flag = amount.compareTo(maximumNumber);
-                BigDecimal redepositAmount = new BigDecimal("0.00");
-                if (flag == 1) { //璐︽埛绉垎澶т簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
-                    redepositAmount = maximumNumber;
-                }
-                if (flag > -1) { //璐︽埛绉垎澶т簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
-                    redepositAmount = maximumNumber;
-                }
-                if (flag == -1) { //璐︽埛绉垎灏忎簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
-                    redepositAmount = amount;
-                }
-                if (flag < 1) { //璐︽埛绉垎灏忎簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
-                    redepositAmount = amount;
-                }
-                if (flag == 0) { //璐︽埛绉垎绛変簬鏈�澶т娇鐢ㄧН鍒�
-                    redepositAmount = amount;
-                }
-                //璁$畻绉垎鎹㈢畻鐨勯噾棰�
-                BigDecimal divide = redepositAmount.divide(deductionProportion);
-                BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
-                //璁$畻瀹炰粯閲戦
-                int flag2 = divide.compareTo(receivedAmount);
-                BigDecimal subtract = new BigDecimal("0.00");
-                //鐢熸垚鎶垫墸鏄庣粏璁板綍
-                if (flag2 == -1) { //绉垎鎹㈢畻閲戦灏忎簬瀹炰粯閲戦
-                    subtract = receivedAmount.subtract(divide);
-                } else if (flag < 1) { //绉垎鎹㈢畻閲戦灏忎簬绛変簬瀹炰粯閲戦
-                    subtract = receivedAmount.subtract(divide);
-                }
-//                integralSum = integralSum.add(subtract);
-                payFeeDetailPo.setReceivedAmount(subtract.toString());
-                integralSum = integralSum.add(divide);
-                // todo 濡傛灉绉垎澶т簬0
-                if (integralSum.doubleValue() > 0) {
-                    FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
-                    feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
-                    feeAccountDetailPo.setDetailId(payFeeDetailPo.getDetailId());
-                    feeAccountDetailPo.setCommunityId(payFeeDetailPo.getCommunityId());
-                    feeAccountDetailPo.setAmount(integralSum.doubleValue() + "");
-                    feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
-                    feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
-                }
-            } else if (AccountDto.ACCT_TYPE_CASH.equals(param.getString("acctType"))) { //鐜伴噾璐︽埛
-                //瀹炴敹閲戦
-                BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
-                int flag = amount.compareTo(receivedAmount);
-                BigDecimal redepositAmount = new BigDecimal(0.00);
-                if (flag == 1) { //鐜伴噾璐︽埛澶т簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
-                    redepositAmount = receivedAmount;
-                }
-                if (flag > -1) { //鐜伴噾璐︽埛澶т簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
-                    redepositAmount = receivedAmount;
-                }
-                if (flag == -1) { //鐜伴噾璐︽埛灏忎簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
-                    redepositAmount = amount;
-                }
-                if (flag < 1) { //鐜伴噾璐︽埛灏忎簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
-                    redepositAmount = amount;
-                }
-                if (flag == 0) { //鐜伴噾璐︽埛绛変簬瀹炴敹閲戦
-                    redepositAmount = amount;
-                }
-                cashSum = cashSum.add(redepositAmount);
 
+            //瀹炴敹閲戦
+            BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
+            int flag = amount.compareTo(receivedAmount);
+            BigDecimal redepositAmount = new BigDecimal(0.00);
+            if (flag == 1) { //鐜伴噾璐︽埛澶т簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
+                redepositAmount = receivedAmount;
             }
+            if (flag > -1) { //鐜伴噾璐︽埛澶т簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄥ疄鏀堕噾棰�
+                redepositAmount = receivedAmount;
+            }
+            if (flag == -1) { //鐜伴噾璐︽埛灏忎簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
+                redepositAmount = amount;
+            }
+            if (flag < 1) { //鐜伴噾璐︽埛灏忎簬绛変簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴�
+                redepositAmount = amount;
+            }
+            if (flag == 0) { //鐜伴噾璐︽埛绛変簬瀹炴敹閲戦
+                redepositAmount = amount;
+            }
+            cashSum = cashSum.add(redepositAmount);
 
-            // todo 濡傛灉绉垎澶т簬0
-            if (integralSum.doubleValue() > 0) {
-                FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
-                feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
-                feeAccountDetailPo.setDetailId(payFeeDetailPo.getDetailId());
-                feeAccountDetailPo.setCommunityId(payFeeDetailPo.getCommunityId());
-                feeAccountDetailPo.setAmount(integralSum.doubleValue() + "");
-                feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
-                feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
-            }
             if (cashSum.doubleValue() > 0) {
                 //鐢熸垚鎶垫墸鏄庣粏璁板綍
                 FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
@@ -784,7 +708,7 @@
             endCalender.setTime(endTime);
             BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
             cycles = receivedAmount.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
-            targetEndTime = computeFeeSMOImpl.getTargetEndTime(cycles.doubleValue(),endCalender.getTime(),true);
+            targetEndTime = computeFeeSMOImpl.getTargetEndTime(cycles.doubleValue(), endCalender.getTime(), true);
             paramInJson.put("tmpCycles", cycles.doubleValue());
             businessFeeDetail.put("cycles", cycles.doubleValue());
             //澶勭悊 鍙兘杩樺瓨鍦� 瀹炴敹鎵嬪伐鍑忓厤鐨勬儏鍐�
@@ -799,7 +723,7 @@
             }
         } else if (PayFeeDataDto.TEMP_CYCLE_CUSTOM_END_TIME.equals(paramInJson.getString("cycles"))) { //todo 杩欓噷鎸夌即璐圭粨鏉熸椂闂寸即璐�
             String custEndTime = paramInJson.getString("custEndTime");
-            if(!custEndTime.contains(":")){
+            if (!custEndTime.contains(":")) {
                 custEndTime += " 23:59:59";
             }
             targetEndTime = DateUtil.getDateFromStringA(custEndTime);
@@ -821,7 +745,7 @@
             }
         } else if ("-105".equals(paramInJson.getString("cycles"))) { //杩欓噷鎸夎嚜瀹氫箟鏃堕棿娈�
             String customEndTime = paramInJson.getString("customEndTime");
-            if(!customEndTime.contains(":")){
+            if (!customEndTime.contains(":")) {
                 customEndTime += " 23:59:59";
             }
             targetEndTime = DateUtil.getDateFromStringA(customEndTime);
@@ -903,7 +827,7 @@
                 businessFee.put("state", FeeDto.STATE_FINISH);
                 businessFee.put("endTime", maxEndTime);
             }
-        }else{
+        } else {
             businessFee.put("state", FeeDto.STATE_FINISH);
         }
         return businessFee;
@@ -924,13 +848,6 @@
             BigDecimal receivedAmount = new BigDecimal(paramObj.getString("receivedAmount")); //瀹炴敹娆撅紙鎵f閲戦锛�
             BigDecimal redepositAmount = new BigDecimal("0.00");//鎶垫墸閲戦
             JSONObject param = jsonArray.getJSONObject(columnIndex);
-            if (!StringUtil.isEmpty(param.getString("acctType")) && param.getString("acctType").equals("2004")) { //绉垎璐︽埛
-                //鑾峰彇鎶垫墸姣斾緥
-                BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
-                //璁$畻瀹炴敹娆炬墍鎵g殑绉垎
-                BigDecimal multiply = receivedAmount.multiply(deductionProportion);
-                receivedAmount = multiply;
-            }
             //璐︽埛閲戦
             BigDecimal amount = new BigDecimal(param.getString("amount"));
             int flag = amount.compareTo(receivedAmount);
@@ -938,69 +855,6 @@
                 redepositAmount = amount;//鎶垫墸閲戦
             } else {
                 redepositAmount = receivedAmount;//鎶垫墸閲戦
-            }
-            if ("2004".equals(param.getString("acctType"))) {
-                //鑾峰彇鏈�澶ф姷鎵gН鍒�
-                BigDecimal maximumNumber = new BigDecimal(param.getString("maximumNumber"));
-                //鑾峰彇绉垎鎶垫墸
-                BigDecimal deductionProportion = new BigDecimal(param.getString("deductionProportion"));
-                int flag2 = amount.compareTo(maximumNumber);
-                if (flag2 == 1) { //璐︽埛绉垎澶т簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
-                    int flag3 = maximumNumber.compareTo(receivedAmount);
-                    if (flag3 == 1) { //濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庣瓑浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = maximumNumber;
-                    }
-                }
-                if (flag2 > -1) { //璐︽埛绉垎澶т簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤鏈�澶т娇鐢ㄧН鍒嗘姷鎵�
-                    int flag3 = maximumNumber.compareTo(receivedAmount);
-                    if (flag3 == 1) { //濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//濡傛灉鏈�澶т娇鐢ㄧН鍒嗗ぇ浜庣瓑浜庡疄鏀堕噾棰濇姷鎵gН鍒嗭紝灏辨妸瀹炴敹閲戦鎶垫墸绉垎璧嬪�肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = maximumNumber;
-                    }
-                }
-                if (flag2 == -1) { //璐︽埛绉垎灏忎簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = amount;
-                    }
-                }
-                if (flag2 < 1) { //璐︽埛绉垎灏忎簬绛変簬鏈�澶т娇鐢ㄧН鍒嗭紝灏辩敤璐︽埛绉垎鎶垫墸
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = amount;
-                    }
-                }
-                if (flag2 == 0) { //璐︽埛绉垎绛変簬鏈�澶т娇鐢ㄧН鍒�
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //濡傛灉绉垎璐︽埛澶т簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//濡傛灉绉垎璐︽埛澶т簬绛変簬瀹炴敹閲戦鎶垫墸绉垎锛屽氨鎶婂疄鏀堕噾棰濇姷鎵gН鍒嗚祴鍊肩粰鎶垫墸绉垎
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = amount;
-                    }
-                }
-                //璁$畻绉垎鎹㈢畻鐨勯噾棰�
-                BigDecimal divide = redepositAmount.divide(deductionProportion);
-                BigDecimal divide1 = receivedAmount.divide(deductionProportion);
-                //璁$畻杩橀渶鏀粯鐨勯噾棰�
-                BigDecimal subtract = divide1.subtract(divide);
-                paramObj.put("receivedAmount", subtract);
             }
             String acctId = param.getString("acctId");
             if (StringUtil.isEmpty(acctId)) {
@@ -1011,7 +865,7 @@
             //鏌ヨ璐︽埛閲戦
             accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
             Assert.listOnlyOne(accountDtos, "鏌ヨ璐︽埛閲戦閿欒锛�");
-            if (accountDtos != null && accountDtos.size() > 0) {
+            if (!ListUtil.isNull(accountDtos)) {
                 AccountDto accountDto1 = accountDtos.get(0);
                 BigDecimal accountDto1Amount = new BigDecimal(accountDto1.getAmount());
                 if (accountDto1Amount.compareTo(redepositAmount) == -1) {
@@ -1104,16 +958,8 @@
         tmpPayFeeDetailPo.setState(FeeDetailDto.STATE_OWE);
         tmpPayFeeDetailPo.setOpenInvoice("N");
         tmpPayFeeDetailPo.setRemark("鎸夌即璐规椂闂存缂磋垂,杩欓儴鍒嗚垂鐢ㄦ寜娆犺垂鐨勬柟寮忛噸鏂扮敓鎴愶紝璇峰湪" + payObjNameRemark + "涓婃煡鐪�");
-        if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
-            BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-            BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-            if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
-                tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
-            } else {
-                tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
-            }
-        }
-        if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
+
+        if (!StringUtil.isEmpty(reqJson.getString("cashAmount"))) {
             BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
             if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
                 tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
@@ -1121,14 +967,7 @@
                 tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
             }
         }
-        if (StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
-            BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
-            if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
-                tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
-            } else {
-                tmpPayFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
-            }
-        }
+
         int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(tmpPayFeeDetailPo);
 
         if (flag < 1) {
diff --git a/service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java b/service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java
index 6614bab..da99136 100644
--- a/service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java
+++ b/service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java
@@ -9,6 +9,7 @@
 import com.java110.dto.account.AccountDto;
 import com.java110.dto.app.AppDto;
 import com.java110.dto.community.CommunityDto;
+import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.log.LogSystemErrorDto;
 import com.java110.dto.store.StoreUserDto;
@@ -23,9 +24,7 @@
 import com.java110.service.smo.ISaveSystemErrorSMO;
 import com.java110.utils.constant.ServiceCodeConstant;
 import com.java110.utils.exception.SMOException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.ExceptionUtil;
+import com.java110.utils.util.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -88,14 +87,17 @@
         AccountDto accountDto = new AccountDto();
         accountDto.setPartId(communityDto.getCommunityId());
         accountDto.setHasMoney("1");
-        accountDto.setAcctType(AccountDto.ACCT_TYPE_CASH);
+        accountDto.setAcctTypes(new String[]{AccountDto.ACCT_TYPE_PROPERTY_FEE, AccountDto.ACCT_TYPE_METER});
         List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
 
-        if (accountDtos == null || accountDtos.size() < 1) {
+        if (ListUtil.isNull(accountDtos)) {
             return;
         }
 
         for (AccountDto tmpAccountDto : accountDtos) {
+            if (StringUtil.isEmpty(tmpAccountDto.getRoomId())) {
+                continue;
+            }
             try {
                 doPayFee(tmpAccountDto);
             } catch (Exception e) {
@@ -112,14 +114,21 @@
 
     private void doPayFee(AccountDto tmpAccountDto) {
 
+        String[] feeTypeCds = null;
+        if (AccountDto.ACCT_TYPE_METER.equals(tmpAccountDto.getAcctType())) {
+            feeTypeCds = new String[]{FeeConfigDto.FEE_TYPE_CD_METER, FeeConfigDto.FEE_TYPE_CD_WATER, FeeConfigDto.FEE_TYPE_CD_GAS};
+        } else if (AccountDto.ACCT_TYPE_PROPERTY_FEE.equals(tmpAccountDto.getAcctType())) {
+            feeTypeCds = new String[]{FeeConfigDto.FEE_TYPE_CD_PROPERTY};
+        }
         // 鏌ヨ涓氫富鐨勮垂鐢�
         FeeDto feeDto = new FeeDto();
         feeDto.setCommunityId(tmpAccountDto.getPartId());
-        feeDto.setOwnerId(tmpAccountDto.getObjId());
+        feeDto.setPayerObjId(tmpAccountDto.getRoomId());
         feeDto.setState(FeeDto.STATE_DOING);
+        feeDto.setFeeTypeCds(feeTypeCds);
         feeDto.setDeductFrom("Y");
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-        if (feeDtos == null || feeDtos.size() < 1) {
+        if (ListUtil.isNull(feeDtos)) {
             return;
         }
         StoreUserDto storeUserDto = new StoreUserDto();
@@ -127,7 +136,7 @@
         storeUserDto.setRelCd(StoreUserDto.REL_CD_MANAGER);
         List<StoreUserDto> storeUserDtos = storeUserV1InnerServiceSMOImpl.queryStoreUsers(storeUserDto);
 
-        Assert.listOnlyOne(storeUserDtos,"娌℃湁鎵f鐨勭敤鎴�");
+        Assert.listOnlyOne(storeUserDtos, "娌℃湁鎵f鐨勭敤鎴�");
 
         List<FeeDto> tmpFeeDtos = new ArrayList<>();
         for (FeeDto tmpFeeDto : feeDtos) {
@@ -138,7 +147,7 @@
             }
         }
 
-        if (tmpFeeDtos.size() < 1) {
+        if (tmpFeeDtos.isEmpty()) {
             return;
         }
         int flag = 0;
@@ -177,7 +186,7 @@
                 param.put("fees", fees);
                 param.put("remark", "瀹氭椂璐︽埛鎵f缂磋垂");
                 try {
-                    CallApiServiceFactory.postForApi(AppDto.JOB_APP_ID, param, ServiceCodeConstant.SERVICE_CODE_PAY_OWE_FEE, JSONObject.class,storeUserDtos.get(0).getUserId());
+                    CallApiServiceFactory.postForApi(AppDto.JOB_APP_ID, param, ServiceCodeConstant.SERVICE_CODE_PAY_OWE_FEE, JSONObject.class, storeUserDtos.get(0).getUserId());
                 } catch (SMOException e) {
                     logger.error("缂磋垂澶辫触", e);
                     accountDetailPo = new AccountDetailPo();
@@ -201,13 +210,6 @@
                 logger.error("鐢熸垚璐圭敤澶辫触", e);
             }
         }
-
-
-        //feeId: _item,
-        //                                startTime: _oweFeeItem.endTime,
-        //                                endTime: _oweFeeItem.deadlineTime,
-        //                                receivedAmount: _oweFeeItem.feePrice,
-        //                                primeRate:$that.owePayFeeOrderInfo.primeRate
 
     }
 
diff --git a/service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java b/service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java
index b2be937..a710af4 100755
--- a/service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java
+++ b/service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java
@@ -24,6 +24,7 @@
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -105,20 +106,27 @@
                 break;
         }
 
-        if(ownerDto == null){
+        if (ownerDto == null) {
             return ResultVo.createResponseEntity(1, 1, ownerDto);
         }
         //todo 鏌ヨ璐︽埛浣欓
         AccountDto accountDto = new AccountDto();
         accountDto.setObjId(ownerDto.getMemberId());
         accountDto.setPartId(communityId);
-        accountDto.setAcctType(AccountDto.ACCT_TYPE_CASH);
-        List<AccountDto> accountDtos =accountInnerServiceSMOImpl.queryAccounts(accountDto);
-        if(!ListUtil.isNull(accountDtos)){
-            ownerDto.setAcctAmount(accountDtos.get(0).getAmount());
+        List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
+        if (ListUtil.isNull(accountDtos)) {
+            return ResultVo.createResponseEntity(1, 1, ownerDto);
         }
+        BigDecimal accountDec = new BigDecimal("0");
+        for (AccountDto tmpAccountDto : accountDtos) {
+            accountDec = accountDec.add(new BigDecimal(tmpAccountDto.getAmount()));
+        }
+        accountDec = accountDec.setScale(2, BigDecimal.ROUND_HALF_UP);
+
+        ownerDto.setAcctAmount(accountDec.doubleValue() + "");
 
         return ResultVo.createResponseEntity(1, 1, ownerDto);
+
     }
 
     /**
@@ -199,7 +207,7 @@
         ownerDto.setName(searchValue);
         ownerDto.setOwnerTypeCds(new String[]{OwnerDto.OWNER_TYPE_CD_MEMBER});
         List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
-        Assert.isNotNull(ownerDtos,"鏈壘鍒版垚鍛樹俊鎭紝璇锋崲鍏朵粬鏉′欢鏌ヨ");
+        Assert.isNotNull(ownerDtos, "鏈壘鍒版垚鍛樹俊鎭紝璇锋崲鍏朵粬鏉′欢鏌ヨ");
         //Assert.listOnlyOne(ownerDtos, "鏈壘鍒版垚鍛樹俊鎭垨鑰呮煡璇㈠埌澶氭潯锛岃鎹㈠叾浠栨潯浠舵煡璇�");
         OwnerDto owner = queryByOwnerId(communityId, ownerDtos.get(0).getOwnerId());
         //鏌ヨ鏄惁鏈夎劚鏁忔潈闄�
@@ -470,7 +478,7 @@
             throw new IllegalArgumentException("鏌ヨ鍐呭鏍煎紡閿欒锛岃杈撳叆 妤兼爧-鍟嗛摵 濡� 1-1");
         }
 
-        String[] values = searchValue.split("-",3);
+        String[] values = searchValue.split("-", 3);
 
         if (values.length != 2) {
             throw new IllegalArgumentException("鏌ヨ鍐呭鏍煎紡閿欒锛岃杈撳叆 妤兼爧-鍟嗛摵 濡� 1-1");
@@ -530,7 +538,7 @@
             throw new IllegalArgumentException("鏌ヨ鍐呭鏍煎紡閿欒锛岃杈撳叆 妤兼爧-鍗曞厓-鎴垮眿 濡� 1-1-1");
         }
 
-        String[] values = searchValue.split("-",3);
+        String[] values = searchValue.split("-", 3);
 
         if (values.length != 3) {
             throw new IllegalArgumentException("鏌ヨ鍐呭鏍煎紡閿欒锛岃杈撳叆 妤兼爧-鍗曞厓-鎴垮眿 濡� 1-1-1");
@@ -544,7 +552,7 @@
 
         List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
         //Assert.listOnlyOne(roomDtos, "鏈壘鍒版埧灞嬩俊鎭�");
-        if(roomDtos == null || roomDtos.size() < 1){
+        if (roomDtos == null || roomDtos.size() < 1) {
             throw new IllegalArgumentException("鏈壘鍒版埧灞嬩俊鎭�");
         }
 
@@ -554,7 +562,7 @@
         ownerDto.setOwnerTypeCd(OwnerDto.OWNER_TYPE_CD_OWNER);
         List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
         //Assert.listOnlyOne(ownerDtos, "鏈壘鍒颁笟涓讳俊鎭�");
-        if(ownerDtos == null || ownerDtos.size() < 1){
+        if (ownerDtos == null || ownerDtos.size() < 1) {
             throw new IllegalArgumentException("鏈壘鍒颁笟涓讳俊鎭�");
         }
 

--
Gitblit v1.8.0