| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.report.ReportCarDto; |
| | |
| | | import com.java110.dto.report.ReportFeeDto; |
| | | import com.java110.dto.report.ReportRoomDto; |
| | | import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto; |
| | | import com.java110.intf.community.IFloorInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.community.IUnitInnerServiceSMO; |
| | | import com.java110.intf.report.IGeneratorFeeMonthStatisticsInnerServiceSMO; |
| | | import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo; |
| | | 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 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; |
| | |
| | | private IReportFeeMonthStatisticsServiceDao reportFeeMonthStatisticsServiceDaoImpl; |
| | | |
| | | @Autowired |
| | | private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IReportCommunityServiceDao reportCommunityServiceDaoImpl; |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IUnitInnerServiceSMO unitInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFloorInnerServiceSMO floorInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public int generatorData(@RequestBody ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) { |
| | | |
| | |
| | | } |
| | | |
| | | @Async |
| | | private void doGeneratorData(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) { |
| | | public void doGeneratorData(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) { |
| | | String communityId = reportFeeMonthStatisticsPo.getCommunityId(); |
| | | |
| | | Assert.hasLength(communityId, "未包含小区信息"); |
| | | |
| | | //这里处理 报表中的费用是否被人为 取消 或者费用项是否被删除,这种数据 报表中做清理,以防影响 报表的准确度 |
| | | feeDataFiltering(communityId); |
| | | |
| | | //处理房屋费用 |
| | | dealRoomFee(reportFeeMonthStatisticsPo); |
| | |
| | | |
| | | //处理缴费结束的情况 |
| | | dealFinishFee(communityId); |
| | | } |
| | | |
| | | private void feeDataFiltering(String communityId) { |
| | | Map reportFeeDto = new HashMap(); |
| | | reportFeeDto.put("communityId", communityId); |
| | | List<Map> feeDtos = reportFeeMonthStatisticsServiceDaoImpl.queryInvalidFeeMonthStatistics(reportFeeDto); |
| | | |
| | | List<String> feeIds = new ArrayList<>(); |
| | | for (Map feeDto : feeDtos) { |
| | | if (!feeDto.containsKey("feeId") || StringUtil.isNullOrNone(feeDto.get("feeId"))) { |
| | | continue; |
| | | } |
| | | |
| | | feeIds.add(feeDto.get("feeId").toString()); |
| | | |
| | | if (feeIds.size() >= 50) { |
| | | reportFeeDto.put("feeIds", feeIds); |
| | | reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto); |
| | | feeIds = new ArrayList<>(); |
| | | } |
| | | } |
| | | reportFeeDto.put("feeIds", feeIds); |
| | | if (feeIds.size() > 0) { |
| | | reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto); |
| | | } |
| | | } |
| | | |
| | | private void dealFinishFee(String communityId) { |
| | |
| | | reportFeeMonthStatisticsDto.setCommunityId(tmpReportCarDto.getCommunityId()); |
| | | reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId()); |
| | | //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());//这里不能注释 如果一个费用创建多条时会有bug |
| | | reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType()); |
| | | reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + ""); |
| | | reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + ""); |
| | |
| | | reportFeeMonthStatisticsPo.setCurReceivedAmount(getReceivedAmount(tmpReportFeeDto, 1) + ""); |
| | | reportFeeMonthStatisticsPo.setHisOweReceivedAmount(getReceivedAmount(tmpReportFeeDto, 2) + ""); |
| | | reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + ""); |
| | | if (!StringUtil.isEmpty(statistic.getObjType()) && statistic.getObjType().equals("3333")) { //房屋 |
| | | reportFeeMonthStatisticsPo.setObjNameNum(statistic.getFloorNum() + "-" + statistic.getUnitNum() + "-" + statistic.getRoomNum()); |
| | | } |
| | | reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo)); |
| | | } else { |
| | | reportFeeMonthStatisticsPo.setOweAmount(oweAmount + ""); |
| | |
| | | reportFeeMonthStatisticsPo.setObjType(FeeDto.PAYER_OBJ_TYPE_CAR); |
| | | reportFeeMonthStatisticsPo.setFeeName(tmpReportFeeDto.getFeeName()); |
| | | reportFeeMonthStatisticsPo.setObjName(tmpReportCarDto.getCarNum() + "(" + tmpReportCarDto.getAreaNum() + "停车场" + tmpReportCarDto.getNum() + "车位)"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(tmpReportCarDto.getAreaNum() + "-" + tmpReportCarDto.getNum() + "-" + tmpReportCarDto.getCarNum()); |
| | | reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + ""); |
| | | reportFeeMonthStatisticsPo.setCurReceivableAmount(getCurFeeReceivableAmount(tmpReportFeeDto) + ""); |
| | |
| | | } 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.setObjType(FeeDto.PAYER_OBJ_TYPE_CAR); |
| | | reportFeeMonthStatisticsPo.setFeeName(tmpReportFeeDto.getFeeName()); |
| | | reportFeeMonthStatisticsPo.setObjName(tmpReportCarDto.getCarNum() + "(" + tmpReportCarDto.getAreaNum() + "停车场" + tmpReportCarDto.getNum() + "车位)"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(tmpReportCarDto.getAreaNum() + "-" + tmpReportCarDto.getNum() + "-" + tmpReportCarDto.getCarNum()); |
| | | reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo)); |
| | | |
| | |
| | | reportFeeMonthStatisticsDto.setCommunityId(reportRoomDto.getCommunityId()); |
| | | reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId()); |
| | | //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); //这里不能注释,因为一个费用多次创建时会存在覆盖 存在bug问题 |
| | | reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType()); |
| | | int year = DateUtil.getYear(); |
| | | int month = DateUtil.getMonth(); |
| | | reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + ""); |
| | | reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + ""); |
| | | List<ReportFeeMonthStatisticsDto> statistics = BeanConvertUtil.covertBeanList( |
| | | reportFeeMonthStatisticsServiceDaoImpl.getReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)), |
| | | ReportFeeMonthStatisticsDto.class); |
| | | //List<ReportFeeMonthStatisticsDto> statistics = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeMonthStatisticss(reportFeeMonthStatisticsDto); |
| | | |
| | | |
| | | //double receivedAmount = getReceivedAmount(tmpReportFeeDto); //实收 |
| | |
| | | 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 |
| | | String objId = statistic.getObjId(); |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setRoomId(objId); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | if (roomDtos != null && roomDtos.size() == 1) { |
| | | String roomNum = roomDtos.get(0).getRoomNum(); |
| | | UnitDto unitDto = new UnitDto(); |
| | | unitDto.setUnitId(roomDtos.get(0).getUnitId()); |
| | | List<UnitDto> unitDtos = unitInnerServiceSMOImpl.queryUnits(unitDto); |
| | | if (unitDtos != null && unitDtos.size() == 1) { |
| | | String unitNum = unitDtos.get(0).getUnitNum(); |
| | | FloorDto floorDto = new FloorDto(); |
| | | floorDto.setFloorId(unitDtos.get(0).getFloorId()); |
| | | List<FloorDto> floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); |
| | | if(floorDtos != null && floorDtos.size() == 1){ |
| | | String floorNum = floorDtos.get(0).getFloorNum(); |
| | | statistic.setObjNameNum(floorNum + "-" + unitNum + "-" + roomNum); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo)); |
| | | } else { |
| | | reportFeeMonthStatisticsPo.setOweAmount(oweAmount + ""); |
| | |
| | | reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName()); |
| | | if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) { |
| | | reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "栋" + reportRoomDto.getUnitNum() + "单元" + reportRoomDto.getRoomNum() + "室"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } else { |
| | | reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "栋" + reportRoomDto.getRoomNum() + "室"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } |
| | | //计算历史欠费 |
| | | reportFeeMonthStatisticsPo.setHisOweAmount(getHisOweAmount(tmpReportFeeDto) + ""); |
| | |
| | | reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + ""); |
| | | reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo)); |
| | | //处理水电费,水电费根据开始时间要在相应月补充数据 |
| | | dealMeteWater(reportFeeMonthStatisticsPo, tmpReportFeeDto); |
| | | } |
| | | |
| | | |
| | |
| | | tmpReportFeeMonthStatisticsPo.setCurMaxTime(DateUtil.getFormatTimeString(endTime, DateUtil.DATE_FORMATE_STRING_A)); |
| | | tmpReportFeeMonthStatisticsPo.setOweAmount("0"); |
| | | reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsOwe(BeanConvertUtil.beanCovertMap(tmpReportFeeMonthStatisticsPo)); |
| | | } |
| | | |
| | | /** |
| | | * 处理水电费 |
| | | * |
| | | * @param reportFeeMonthStatisticsPo |
| | | * @param tmpReportFeeDto |
| | | */ |
| | | private void dealMeteWater(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo, ReportFeeDto tmpReportFeeDto) { |
| | | |
| | | //如果是 水费 电费 煤气费 |
| | | 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 curYear = DateUtil.getFormatTimeString(endTime, "YYYY"); |
| | | //查询是否存在 数据 |
| | | ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto(); |
| | | reportFeeMonthStatisticsDto.setCommunityId(tmpReportFeeDto.getCommunityId()); |
| | | reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId()); |
| | | //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType()); |
| | | reportFeeMonthStatisticsDto.setFeeYear(curYear); |
| | | reportFeeMonthStatisticsDto.setFeeMonth(curMonth); |
| | | List<ReportFeeMonthStatisticsDto> statistics = BeanConvertUtil.covertBeanList( |
| | | reportFeeMonthStatisticsServiceDaoImpl.getReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)), |
| | | ReportFeeMonthStatisticsDto.class); |
| | | if (!ListUtil.isNull(statistics)) { |
| | | return; |
| | | } |
| | | reportFeeMonthStatisticsPo.setStatisticsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_statisticsId)); |
| | | reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo)); |
| | | } |
| | | |
| | | |
| | |
| | | BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice()); |
| | | |
| | | Date curDate = DateUtil.getFirstDate(); |
| | | Date nowDate = DateUtil.getCurrentDate(); |
| | | double month = 0.0; |
| | | //已经超过截止时间 和 还没有到开始时间 |
| | | if (curDate.getTime() > tmpReportFeeDto.getDeadlineTime().getTime() |
| | | || curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) { |
| | | || nowDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) { |
| | | return 0.0; |
| | | } |
| | | |
| | | //如果 1号小于 计费起始时间 那么 将curDate 改为 当前时间 |
| | | if (curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) { |
| | | curDate = tmpReportFeeDto.getEndTime(); |
| | | } |
| | | |
| | | //这里需要判断 结束时间 是否 大于了当月最后一天,当月天数 * 每天金额 |
| | |
| | | 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)); |
| | |
| | | reportFeeMonthStatisticsPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName()); |
| | | if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) { |
| | | reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "栋" + reportRoomDto.getUnitNum() + "单元" + reportRoomDto.getRoomNum() + "室"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } else { |
| | | reportFeeMonthStatisticsPo.setObjName(reportRoomDto.getFloorNum() + "栋" + reportRoomDto.getRoomNum() + "室"); |
| | | reportFeeMonthStatisticsPo.setObjNameNum(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } |
| | | //计算历史欠费 |
| | | reportFeeMonthStatisticsPo.setHisOweAmount("0"); |
| | |
| | | } |
| | | 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) |
| | |
| | | //算天数 |
| | | 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()) |
| | | && 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 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; |
| | | } |
| | | |
| | |
| | | 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); |
| | | 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()) |
| | | && 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(); |
| | | return curDegree.multiply(feePriceDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | return 0.0; |
| | | } |