| | |
| | | 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; |
| | |
| | | } 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.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 |
| | |
| | | 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(); |
| | |
| | | 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()); |
| | |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | } |
| | | |
| | | |
| | |
| | | } 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)); |
| | |
| | | //算天数 |
| | | 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()) |
| | |
| | | //算天数 |
| | | 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; |
| | | } |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | //算天数 |
| | | 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()) |
| | |
| | | //算天数 |
| | | 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; |
| | | } |