| | |
| | | import com.java110.report.dao.IReportFeeServiceDao; |
| | | import com.java110.utils.util.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | Assert.hasLength(communityId, "未包含小区信息"); |
| | | |
| | | //这里处理 报表中的费用是否被人为 取消 或者费用项是否被删除,这种数据 报表中做清理,以防影响 报表的准确度 |
| | | feeDataFiltering(communityId); |
| | | |
| | | //处理房屋费用 |
| | | dealRoomFee(reportFeeMonthStatisticsPo); |
| | | |
| | |
| | | |
| | | //处理缴费结束的情况 |
| | | dealFinishFee(communityId); |
| | | } |
| | | |
| | | private void feeDataFiltering(String communityId) { |
| | | Map reportFeeDto = new HashMap(); |
| | | reportFeeDto.put("communityId", communityId); |
| | | reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto); |
| | | } |
| | | |
| | | private void dealFinishFee(String communityId) { |
| | |
| | | // reportFeeMonthStatisticsPo.setReceivedAmount("0"); |
| | | reportFeeMonthStatisticsPo.setOweAmount(oweAmount + ""); |
| | | reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | // 缴费了就得刷 |
| | | reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + ""); |
| | | //有可能是月内创建的费用 比如电费水费 |
| | | reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + ""); |
| | | reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + ""); |
| | | reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + ""); |
| | | reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + ""); |
| | |
| | | reportFeeMonthStatisticsPo.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName()); |
| | | // 缴费了就得刷 |
| | | reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + ""); |
| | | //有可能是月内创建的费用 比如电费水费 |
| | | reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + ""); |
| | | reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + ""); |
| | | reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + ""); |
| | | reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + ""); |
| | |
| | | } |
| | | Date endTime = ownerCarDtos.get(0).getEndTime(); |
| | | |
| | | Date maxEndDate = tmpReportFeeDto.getDeadlineTime(); |
| | | if(FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())){ |
| | | maxEndDate = tmpReportFeeDto.getConfigEndTime(); |
| | | } |
| | | |
| | | //1.0 费用到期时间和费用结束时间 都不在当月 |
| | | if (!belongCurMonth(tmpReportFeeDto.getEndTime()) |
| | | && !belongCurMonth(endTime) |
| | |
| | | if (!belongCurMonth(tmpReportFeeDto.getEndTime()) |
| | | && belongCurMonth(endTime)) { |
| | | //算天数 |
| | | double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime()); |
| | | double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate); |
| | | BigDecimal curDegree = new BigDecimal(month); |
| | | return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | |
| | | return computeOnceFee(tmpReportFeeDto); |
| | | } |
| | | |
| | | Date maxEndDate = tmpReportFeeDto.getDeadlineTime(); |
| | | if(FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())){ |
| | | maxEndDate = tmpReportFeeDto.getConfigEndTime(); |
| | | } |
| | | |
| | | //1.0 费用到期时间和费用结束时间 都不在当月 |
| | | if (!belongCurMonth(tmpReportFeeDto.getEndTime()) |
| | | && !belongCurMonth(tmpReportFeeDto.getConfigEndTime()) |
| | | && !belongCurMonth(maxEndDate) |
| | | && tmpReportFeeDto.getEndTime().getTime() < DateUtil.getFirstDate().getTime()) { |
| | | return feePrice; |
| | | } |
| | | |
| | | //2.0 费用到期时间 在当月,费用结束时间不在当月 |
| | | if (belongCurMonth(tmpReportFeeDto.getEndTime()) |
| | | && !belongCurMonth(tmpReportFeeDto.getConfigEndTime())) { |
| | | && !belongCurMonth(maxEndDate)) { |
| | | //算天数 |
| | | double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate()); |
| | | BigDecimal curDegree = new BigDecimal(month); |
| | |
| | | } |
| | | //3.0 费用到期时间 不在当月,费用结束时间在当月 |
| | | if (!belongCurMonth(tmpReportFeeDto.getEndTime()) |
| | | && belongCurMonth(tmpReportFeeDto.getConfigEndTime())) { |
| | | && belongCurMonth(maxEndDate)) { |
| | | //算天数 |
| | | double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime()); |
| | | double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate); |
| | | BigDecimal curDegree = new BigDecimal(month); |
| | | return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |