Selaa lähdekoodia

扣款只扣物业费和水电费扣款

wuxw 1 vuosi sitten
vanhempi
commit
4e992596dd

+ 1 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java

@@ -25,6 +25,7 @@ public class FeeConfigDto extends PageDto implements Serializable {
     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";//系统

+ 4 - 1
service-acct/src/main/java/com/java110/acct/cmd/account/QueryCommunityOwnerAccountCmd.java

@@ -20,6 +20,7 @@ import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
 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 @@ public class QueryCommunityOwnerAccountCmd extends Cmd {
             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();

+ 29 - 190
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java

@@ -250,16 +250,8 @@ public class PayFeeCmd extends Cmd {
             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 + "元");
@@ -267,14 +259,6 @@ public class PayFeeCmd extends Cmd {
                     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);
             if (flag < 1) {
                 throw new CmdException("缴费失败");
@@ -332,94 +316,34 @@ public class PayFeeCmd extends Cmd {
             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"))) { //积分账户
-                //获取最大抵扣积分
-                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;
             }
-
-            // 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 (flag > -1) { //现金账户大于等于实收金额,就用实收金额
+                redepositAmount = receivedAmount;
+            }
+            if (flag == -1) { //现金账户小于实收金额,就用现金账户
+                redepositAmount = amount;
+            }
+            if (flag < 1) { //现金账户小于等于实收金额,就用现金账户
+                redepositAmount = amount;
+            }
+            if (flag == 0) { //现金账户等于实收金额
+                redepositAmount = amount;
             }
+            cashSum = cashSum.add(redepositAmount);
+
             if (cashSum.doubleValue() > 0) {
                 //生成抵扣明细记录
                 FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
@@ -784,7 +708,7 @@ public class PayFeeCmd extends Cmd {
             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 @@ public class PayFeeCmd extends Cmd {
             }
         } 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 @@ public class PayFeeCmd extends Cmd {
             }
         } 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 @@ public class PayFeeCmd extends Cmd {
                 businessFee.put("state", FeeDto.STATE_FINISH);
                 businessFee.put("endTime", maxEndTime);
             }
-        }else{
+        } else {
             businessFee.put("state", FeeDto.STATE_FINISH);
         }
         return businessFee;
@@ -924,13 +848,6 @@ public class PayFeeCmd extends Cmd {
             BigDecimal receivedAmount = new BigDecimal(paramObj.getString("receivedAmount")); //实收款(扣款金额)
             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"));
-                //计算实收款所扣的积分
-                BigDecimal multiply = receivedAmount.multiply(deductionProportion);
-                receivedAmount = multiply;
-            }
             //账户金额
             BigDecimal amount = new BigDecimal(param.getString("amount"));
             int flag = amount.compareTo(receivedAmount);
@@ -939,69 +856,6 @@ public class PayFeeCmd extends Cmd {
             } else {
                 redepositAmount = receivedAmount;//抵扣金额
             }
-            if ("2004".equals(param.getString("acctType"))) {
-                //获取最大抵扣积分
-                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) { //如果最大使用积分大于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//如果最大使用积分大于等于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = maximumNumber;
-                    }
-                }
-                if (flag2 > -1) { //账户积分大于等于最大使用积分,就用最大使用积分抵扣
-                    int flag3 = maximumNumber.compareTo(receivedAmount);
-                    if (flag3 == 1) { //如果最大使用积分大于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//如果最大使用积分大于等于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = maximumNumber;
-                    }
-                }
-                if (flag2 == -1) { //账户积分小于最大使用积分,就用账户积分抵扣
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //如果积分账户大于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//如果积分账户大于等于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = amount;
-                    }
-                }
-                if (flag2 < 1) { //账户积分小于等于最大使用积分,就用账户积分抵扣
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //如果积分账户大于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//如果积分账户大于等于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else {
-                        redepositAmount = amount;
-                    }
-                }
-                if (flag2 == 0) { //账户积分等于最大使用积分
-                    int flag3 = amount.compareTo(receivedAmount);
-                    if (flag3 == 1) { //如果积分账户大于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        redepositAmount = receivedAmount;
-                    } else if (flag3 > -1) {//如果积分账户大于等于实收金额抵扣积分,就把实收金额抵扣积分赋值给抵扣积分
-                        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)) {
                 throw new IllegalArgumentException("账户id为空!");
@@ -1011,7 +865,7 @@ public class PayFeeCmd extends Cmd {
             //查询账户金额
             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 @@ public class PayFeeCmd extends Cmd {
         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 @@ public class PayFeeCmd extends Cmd {
                 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) {

+ 19 - 17
service-job/src/main/java/com/java110/job/task/fee/AccountDeductionPayFeeTemplate.java

@@ -9,6 +9,7 @@ import com.java110.core.smo.IComputeFeeSMO;
 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.po.log.LogSystemErrorPo;
 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 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
         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 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
 
     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 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
         storeUserDto.setRelCd(StoreUserDto.REL_CD_MANAGER);
         List<StoreUserDto> storeUserDtos = storeUserV1InnerServiceSMOImpl.queryStoreUsers(storeUserDto);
 
-        Assert.listOnlyOne(storeUserDtos,"没有扣款的用户");
+        Assert.listOnlyOne(storeUserDtos, "没有扣款的用户");
 
         List<FeeDto> tmpFeeDtos = new ArrayList<>();
         for (FeeDto tmpFeeDto : feeDtos) {
@@ -138,7 +147,7 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
             }
         }
 
-        if (tmpFeeDtos.size() < 1) {
+        if (tmpFeeDtos.isEmpty()) {
             return;
         }
         int flag = 0;
@@ -177,7 +186,7 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
                 param.put("fees", fees);
                 param.put("remark", "定时账户扣款缴费");
                 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();
@@ -202,13 +211,6 @@ public class AccountDeductionPayFeeTemplate extends TaskSystemQuartz {
             }
         }
 
-
-        //feeId: _item,
-        //                                startTime: _oweFeeItem.endTime,
-        //                                endTime: _oweFeeItem.deadlineTime,
-        //                                receivedAmount: _oweFeeItem.feePrice,
-        //                                primeRate:$that.owePayFeeOrderInfo.primeRate
-
     }
 
 }

+ 18 - 10
service-user/src/main/java/com/java110/user/bmo/owner/impl/ComprehensiveQueryImpl.java

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
                 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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
         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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
             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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
             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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
 
         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 @@ public class ComprehensiveQueryImpl implements IComprehensiveQuery {
         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("未找到业主信息");
         }