java110-bean/src/main/java/com/java110/dto/report/ReportFeeDto.java
@@ -96,6 +96,11 @@ private String roomRent; private String roomArea; private String payOnline; private String scale; private String decimalPlace; private String units; @@ -538,4 +543,36 @@ public void setRoomArea(String roomArea) { this.roomArea = roomArea; } public String getPayOnline() { return payOnline; } public void setPayOnline(String payOnline) { this.payOnline = payOnline; } public String getScale() { return scale; } public void setScale(String scale) { this.scale = scale; } public String getDecimalPlace() { return decimalPlace; } public void setDecimalPlace(String decimalPlace) { this.decimalPlace = decimalPlace; } public String getUnits() { return units; } public void setUnits(String units) { this.units = units; } } java110-bean/src/main/java/com/java110/vo/api/feeConfig/ApiFeeConfigDataVo.java
@@ -12,8 +12,8 @@ private String endTime; private String computingFormula; private String computingFormulaName; private Double squarePrice; private Double additionalAmount; private String squarePrice; private String additionalAmount; private String feeTypeCdName; private String feeFlagName; private String isDefault; @@ -201,19 +201,20 @@ this.units = units; } public Double getSquarePrice() { public String getSquarePrice() { return squarePrice; } public void setSquarePrice(Double squarePrice) { public void setSquarePrice(String squarePrice) { this.squarePrice = squarePrice; } public Double getAdditionalAmount() { public String getAdditionalAmount() { return additionalAmount; } public void setAdditionalAmount(Double additionalAmount) { public void setAdditionalAmount(String additionalAmount) { this.additionalAmount = additionalAmount; } } java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
@@ -833,22 +833,22 @@ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(reportRoomDto.getBuiltUpArea())); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("2002".equals(computingFormula)) { // 固定费用 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("3003".equals(computingFormula)) { // 固定费用 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomArea())); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("1101".equals(computingFormula)) { // 租金 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent())); feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("1102".equals(computingFormula)) { // 租金 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent())); feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("4004".equals(computingFormula)) { feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); } else if ("5005".equals(computingFormula)) { @@ -862,7 +862,7 @@ BigDecimal sub = curDegree.subtract(preDegree); feePrice = sub.multiply(squarePrice) .add(additionalAmount) .setScale(4, BigDecimal.ROUND_HALF_UP); .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } } else if ("6006".equals(computingFormula)) { feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); @@ -879,7 +879,7 @@ BigDecimal sub = curDegree.subtract(preDegree); feePrice = sub.multiply(squarePrice) .add(additionalAmount) .setScale(4, BigDecimal.ROUND_HALF_UP); .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } } else { throw new IllegalArgumentException("暂不支持该类公式"); @@ -891,11 +891,11 @@ BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("0")); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("2002".equals(computingFormula)) { // 固定费用 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } else if ("3003".equals(computingFormula)) { // 固定费用 //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); feePrice = new BigDecimal(0); @@ -916,7 +916,7 @@ BigDecimal sub = curDegree.subtract(preDegree); feePrice = sub.multiply(squarePrice) .add(additionalAmount) .setScale(4, BigDecimal.ROUND_HALF_UP); .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } } else if ("6006".equals(computingFormula)) { feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); @@ -933,13 +933,13 @@ BigDecimal sub = curDegree.subtract(preDegree); feePrice = sub.multiply(squarePrice) .add(additionalAmount) .setScale(4, BigDecimal.ROUND_HALF_UP); .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); } } else { throw new IllegalArgumentException("暂不支持该类公式"); } } return feePrice.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); return feePrice.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); } @Override java110-db/src/main/resources/mapper/report/ReportFeeServiceDaoImplMapper.xml
@@ -65,7 +65,8 @@ t.community_id communityId,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees curDegrees,mw.pre_degrees preDegrees, mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price mwPrice, pfa2.`value` ownerTel, pfa3.`value` ownerName,br.room_area roomArea pfa2.`value` ownerTel, pfa3.`value` ownerName,br.room_area roomArea, pfc.pay_online payOnline,pfc.scale,pfc.decimal_place decimalPlace,pfc.units from pay_fee t INNER JOIN pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0' @@ -112,7 +113,8 @@ startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId, td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName, t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle, t.computing_formula_text,t.computing_formula_text computingFormulaText t.computing_formula_text,t.computing_formula_text computingFormulaText, t.pay_online payOnline,t.scale,t.decimal_place decimalPlace,t.units from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3 where 1 =1 and t.fee_type_cd = td1.status_cd service-fee/src/main/java/com/java110/fee/cmd/feeConfig/ListFeeConfigsCmd.java
@@ -48,6 +48,16 @@ if (count > 0) { feeConfigs = BeanConvertUtil.covertBeanList(feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto), ApiFeeConfigDataVo.class); //处理 小数点后无效的0 for(ApiFeeConfigDataVo feeConfig: feeConfigs){ if (!StringUtil.isEmpty(feeConfig.getAdditionalAmount())){ feeConfig.setAdditionalAmount(Double.parseDouble(feeConfig.getAdditionalAmount())+""); } if (!StringUtil.isEmpty(feeConfig.getSquarePrice())){ feeConfig.setSquarePrice(Double.parseDouble(feeConfig.getSquarePrice())+""); } } } else { feeConfigs = new ArrayList<>(); } service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
@@ -23,6 +23,7 @@ import com.java110.report.dao.IReportCommunityServiceDao; import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao; import com.java110.report.dao.IReportFeeServiceDao; import com.java110.utils.constant.FeeConfigConstant; import com.java110.utils.util.*; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -394,7 +395,7 @@ } else { double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curMonthDate.getTime()); BigDecimal curDegree = new BigDecimal(month); receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } @@ -503,12 +504,25 @@ reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName()); // 缴费了就得刷 reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + ""); reportFeeMonthStatisticsPo.setHisOweAmount(MoneyUtil.computePriceScale(getHisOweAmount(tmpReportFeeDto), tmpReportFeeDto.getScale(), Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + ""); //有可能是月内创建的费用 比如电费水费 reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + ""); reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + ""); reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + ""); reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + ""); reportFeeMonthStatisticsPo.setCurReceivableAmount( MoneyUtil.computePriceScale(getCurFeeReceivableAmount(tmpReportFeeDto), tmpReportFeeDto.getScale(), Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + ""); reportFeeMonthStatisticsPo.setCurReceivedAmount( MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 1), tmpReportFeeDto.getScale(), Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + ""); reportFeeMonthStatisticsPo.setHisOweReceivedAmount( MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 2), tmpReportFeeDto.getScale(), Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + ""); reportFeeMonthStatisticsPo.setPreReceivedAmount(MoneyUtil.computePriceScale(getReceivedAmount(tmpReportFeeDto, 3), tmpReportFeeDto.getScale(), Integer.parseInt(tmpReportFeeDto.getDecimalPlace())) + ""); /*if (!StringUtil.isEmpty(statistic.getObjType()) && statistic.getObjType().equals("3333")) { //房屋 if (!StringUtil.isEmpty(statistic.getObjId())) { //获取付费对象ID @@ -592,13 +606,13 @@ if (!FeeConfigDto.FEE_TYPE_CD_METER.equals(tmpReportFeeDto.getFeeTypeCd()) && !FeeConfigDto.FEE_TYPE_CD_WATER.equals(tmpReportFeeDto.getFeeTypeCd()) && !FeeConfigDto.FEE_TYPE_CD_GAS.equals(tmpReportFeeDto.getFeeTypeCd()) ) { ) { return; } //根据费用开始时间 计算月份 Date endTime = tmpReportFeeDto.getEndTime(); //去除 0 因为表里的月份是没有零 String curMonth = Integer.parseInt(DateUtil.getFormatTimeString(endTime, "MM"))+""; String curMonth = Integer.parseInt(DateUtil.getFormatTimeString(endTime, "MM")) + ""; String curYear = DateUtil.getFormatTimeString(endTime, "YYYY"); //查询是否存在 数据 ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto(); @@ -669,15 +683,15 @@ if (allDays == 0) { // 防止除数为0 return 0; } BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), 2, BigDecimal.ROUND_HALF_EVEN); BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN); if (tmpReportFeeDto.getDeadlineTime().getTime() > nextDate.getTime()) { int day = DateUtil.getCurrentMonthDay(); return moneyPreDay.multiply(new BigDecimal(day)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); return moneyPreDay.multiply(new BigDecimal(day)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); } // 结束时间 在当月内 double hisDays = computeFeeSMOImpl.daysBetween(tmpReportFeeDto.getEndTime(), curDate); BigDecimal hisDayDec = moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(2, BigDecimal.ROUND_HALF_UP); return feePriceDec.subtract(hisDayDec).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); BigDecimal hisDayDec = moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); return feePriceDec.subtract(hisDayDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); } month = computeFeeSMOImpl.dayCompare(curDate, tmpReportFeeDto.getDeadlineTime()); @@ -685,7 +699,7 @@ return 0; } if (month < 1) { return feePriceDec.multiply(new BigDecimal(month)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return feePriceDec.multiply(new BigDecimal(month)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } return tmpReportFeeDto.getFeePrice(); @@ -718,11 +732,11 @@ return 0; } //这是每天的钱 BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), 2, BigDecimal.ROUND_HALF_EVEN); BigDecimal moneyPreDay = feePriceDec.divide(new BigDecimal(allDays), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN); double hisDays = computeFeeSMOImpl.daysBetween(tmpReportFeeDto.getEndTime(), curDate); return moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); return moneyPreDay.multiply(new BigDecimal(hisDays)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); } double month = 0.0; @@ -732,7 +746,7 @@ month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curDate); } BigDecimal curDegree = new BigDecimal(month); return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } @@ -785,7 +799,7 @@ } else { double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), curMonthDate.getTime()); BigDecimal curDegree = new BigDecimal(month); receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); receivableAmount = curDegree.multiply(new BigDecimal(tmpReportFeeDto.getFeePrice())).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo = new ReportFeeMonthStatisticsPo(); reportFeeMonthStatisticsPo.setDeadlineTime(DateUtil.getFormatTimeString(curMonthDate.getTime(), DateUtil.DATE_FORMATE_STRING_A)); @@ -923,7 +937,7 @@ //算天数 double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate()); BigDecimal curDegree = new BigDecimal(month); return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } //3.0 费用到期时间 不在当月,费用结束时间在当月 if (!belongCurMonth(tmpReportFeeDto.getEndTime()) @@ -931,7 +945,7 @@ //算天数 double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate); BigDecimal curDegree = new BigDecimal(month); return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } return 0.0; } @@ -951,7 +965,7 @@ } BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice()); double money = feePriceDec.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); double money = feePriceDec.divide(new BigDecimal(month), FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return money; } @@ -993,7 +1007,7 @@ //算天数 double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate()); BigDecimal curDegree = new BigDecimal(month); return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } //3.0 费用到期时间 不在当月,费用结束时间在当月 if (!belongCurMonth(tmpReportFeeDto.getEndTime()) @@ -1001,7 +1015,7 @@ //算天数 double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate); BigDecimal curDegree = new BigDecimal(month); return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } return 0.0; }