old mode 100644
new mode 100755
| | |
| | | import com.java110.utils.cache.CommonCache; |
| | | 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; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl |
| | |
| | | |
| | | Assert.hasLength(communityId, "未包含小区信息"); |
| | | |
| | | //这里处理 报表中的费用是否被人为 取消 或者费用项是否被删除,这种数据 报表中做清理,以防影响 报表的准确度 |
| | | feeDataFiltering(communityId); |
| | | |
| | | //处理房屋费用 |
| | | dealRoomFee(reportFeeMonthStatisticsPo); |
| | | |
| | | //处理车位费用 |
| | | dealCarFee(reportFeeMonthStatisticsPo); |
| | | |
| | | } |
| | | |
| | | private void feeDataFiltering(String communityId) { |
| | | Map reportFeeDto = new HashMap(); |
| | | reportFeeDto.put("communityId", communityId); |
| | | List<Map> feeDtos = reportCommunityServiceDaoImpl.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); |
| | | reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto); |
| | | feeIds = new ArrayList<>(); |
| | | } |
| | | } |
| | | reportFeeDto.put("feeIds", feeIds); |
| | | if (feeIds.size() > 0) { |
| | | reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | reportFeeDto.setPayerObjId(tmpReportCarDto.getCarId()); |
| | | reportFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_CAR); |
| | | //reportFeeDto.setState(FeeDto.STATE_DOING); |
| | | reportFeeDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); |
| | | //reportFeeDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); |
| | | List<ReportFeeDto> feeDtos = reportFeeServiceDaoImpl.getFees(reportFeeDto); |
| | | |
| | | if (feeDtos == null || feeDtos.size() < 1) { |
| | |
| | | reportFeeYearCollectionDto.setCommunityId(tmpReportCarDto.getCommunityId()); |
| | | reportFeeYearCollectionDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | reportFeeYearCollectionDto.setObjId(tmpReportFeeDto.getPayerObjId()); |
| | | reportFeeYearCollectionDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | //reportFeeYearCollectionDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeYearCollectionDto.setObjType(tmpReportFeeDto.getPayerObjType()); |
| | | List<ReportFeeYearCollectionDto> statistics = BeanConvertUtil.covertBeanList( |
| | | reportFeeYearCollectionServiceDaoImpl.getReportFeeYearCollectionInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionDto)), |
| | |
| | | Calendar configEndTime = Calendar.getInstance(); |
| | | configStartTime.setTime(tmpReportFeeDto.getConfigEndTime()); |
| | | int endYear = configEndTime.get(Calendar.YEAR); |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR); |
| | | double feePrice = computeFeeSMOImpl.getReportFeePrice(tmpReportFeeDto, null, tmpReportCarDto); |
| | | tmpReportFeeDto.setFeePrice(feePrice); |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR) + 1; |
| | | |
| | | FeeDto feeDto = BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class); |
| | | //刷入欠费金额 |
| | | computeFeeSMOImpl.computeEveryOweFee(feeDto); |
| | | |
| | | if (endYear > curYear) { |
| | | endYear = curYear; |
| | | } |
| | | |
| | | for (int year = startYear; year <= endYear; year++) { |
| | | computeYearFee(year, tmpReportFeeDto, reportFeeYearCollectionPo); |
| | | computeYearFee(year, feeDto, reportFeeYearCollectionPo); |
| | | } |
| | | |
| | | } |
| | |
| | | reportFeeDto.setPayerObjId(reportRoomDto.getRoomId()); |
| | | reportFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM); |
| | | //reportFeeDto.setState(FeeDto.STATE_DOING); |
| | | reportFeeDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); |
| | | //reportFeeDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); |
| | | |
| | | List<ReportFeeDto> feeDtos = reportFeeServiceDaoImpl.getFees(reportFeeDto); |
| | | |
| | | if (feeDtos == null || feeDtos.size() < 1) { |
| | |
| | | reportFeeYearCollectionDto.setCommunityId(reportRoomDto.getCommunityId()); |
| | | reportFeeYearCollectionDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | reportFeeYearCollectionDto.setObjId(tmpReportFeeDto.getPayerObjId()); |
| | | reportFeeYearCollectionDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | //reportFeeYearCollectionDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | reportFeeYearCollectionDto.setObjType(tmpReportFeeDto.getPayerObjType()); |
| | | List<ReportFeeYearCollectionDto> statistics = BeanConvertUtil.covertBeanList( |
| | | reportFeeYearCollectionServiceDaoImpl.getReportFeeYearCollectionInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionDto)), |
| | |
| | | reportFeeYearCollectionPo.setObjType(FeeDto.PAYER_OBJ_TYPE_ROOM); |
| | | reportFeeYearCollectionPo.setFeeName(StringUtil.isEmpty(tmpReportFeeDto.getImportFeeName()) ? tmpReportFeeDto.getFeeName() : tmpReportFeeDto.getImportFeeName()); |
| | | if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) { |
| | | reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum() ); |
| | | reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } else { |
| | | reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum() ); |
| | | reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum()); |
| | | } |
| | | reportFeeYearCollectionPo.setOwnerId(reportRoomDto.getOwnerId()); |
| | | reportFeeYearCollectionPo.setOwnerName(reportRoomDto.getOwnerName()); |
| | |
| | | int endYear = configEndTime.get(Calendar.YEAR); |
| | | |
| | | //当前年 |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR); |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR) + 1; |
| | | |
| | | double feePrice = computeFeeSMOImpl.getReportFeePrice(tmpReportFeeDto, reportRoomDto, null); |
| | | tmpReportFeeDto.setFeePrice(feePrice); |
| | | FeeDto feeDto = BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class); |
| | | //刷入欠费金额 |
| | | computeFeeSMOImpl.computeEveryOweFee(feeDto); |
| | | |
| | | if (endYear > curYear) { |
| | | endYear = curYear; |
| | | } |
| | | |
| | | for (int year = startYear; year <= endYear; year++) { |
| | | computeYearFee(year, tmpReportFeeDto, reportFeeYearCollectionPo); |
| | | computeYearFee(year, feeDto, reportFeeYearCollectionPo); |
| | | } |
| | | } |
| | | |
| | |
| | | * 计算指定年的数据 |
| | | * |
| | | * @param year |
| | | * @param tmpReportFeeDto |
| | | * @param feeDto |
| | | * @param reportFeeYearCollectionPo |
| | | */ |
| | | private void computeYearFee(int year, ReportFeeDto tmpReportFeeDto, ReportFeeYearCollectionPo reportFeeYearCollectionPo) { |
| | | private void computeYearFee(int year, FeeDto feeDto, ReportFeeYearCollectionPo reportFeeYearCollectionPo) { |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR); |
| | | |
| | | ReportFeeYearCollectionDetailDto reportFeeYearCollectionDetailDto = new ReportFeeYearCollectionDetailDto(); |
| | |
| | | = BeanConvertUtil.covertBeanList(reportFeeYearCollectionDetailServiceDaoImpl.getReportFeeYearCollectionDetailInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionDetailDto)), |
| | | ReportFeeYearCollectionDetailDto.class); |
| | | |
| | | if (!ListUtil.isNull(reportFeeYearCollectionDetailDtos) && year != curYear) { // 说明已经处理过了 不再处理 |
| | | return; |
| | | } |
| | | // if (!ListUtil.isNull(reportFeeYearCollectionDetailDtos) && year != curYear) { // 说明已经处理过了 不再处理 |
| | | // return; |
| | | // } |
| | | |
| | | double receivableAmount = getReceivableAmount(tmpReportFeeDto); |
| | | double receivableAmount = feeDto.getFeePrice(); |
| | | |
| | | double receivedAmount = getReceivedAmount(tmpReportFeeDto, year); |
| | | double receivedAmount = getReceivedAmount(feeDto, year); |
| | | |
| | | ReportFeeYearCollectionDetailPo reportFeeYearCollectionDetailPo = null; |
| | | |
| | |
| | | int curYear = Calendar.getInstance().get(Calendar.YEAR); |
| | | double cycleMonth = 12; |
| | | |
| | | if (FeeDto.FEE_FLAG_ONCE.equals(tmpReportFeeDto.getFeeFlag()) && FeeDto.STATE_DOING.equals(tmpReportFeeDto.getState())) { // 一次性费用 费用没有结束 |
| | | return StringUtil.isEmpty(tmpReportFeeDto.getAmount()) ? 0 : Double.parseDouble(tmpReportFeeDto.getAmount()); |
| | | } |
| | | |
| | | if (FeeDto.FEE_FLAG_ONCE.equals(tmpReportFeeDto.getFeeFlag())) { // 一次性费用没有应收 所以写成0 |
| | | return 0; |
| | | } |
| | | |
| | | if (endYear == curYear) { |
| | | try { |
| | | cycleMonth = computeFeeSMOImpl.dayCompare(DateUtil.getDateFromString(curYear + "-01-01", DateUtil.DATE_FORMATE_STRING_B), tmpReportFeeDto.getConfigEndTime()); |
| | |
| | | * @param tmpReportFeeDto |
| | | * @return |
| | | */ |
| | | private double getReceivedAmount(ReportFeeDto tmpReportFeeDto, int year) { |
| | | private double getReceivedAmount(FeeDto tmpReportFeeDto, int year) { |
| | | ReportFeeDetailDto feeDetailDto = new ReportFeeDetailDto(); |
| | | feeDetailDto.setFeeId(tmpReportFeeDto.getFeeId()); |
| | | feeDetailDto.setConfigId(tmpReportFeeDto.getConfigId()); |
| | | feeDetailDto.setPayerObjId(tmpReportFeeDto.getPayerObjId()); |
| | | String flag = CommonCache.getValue(RECEIVED_TIME); |
| | | if (RECEIVED_TIME_START.equals(flag)) { |
| | | feeDetailDto.setStartTime(year + ""); |
| | | feeDetailDto.setCurStartYear(year + ""); |
| | | } else { |
| | | feeDetailDto.setEndTime(year + ""); |
| | | feeDetailDto.setCurEndYear(year + ""); |
| | | } |
| | | double receivedAmount = reportFeeServiceDaoImpl.getFeeReceivedAmount(feeDetailDto); |
| | | |