| | |
| | | package com.java110.report.bmo.reportFeeMonthStatistics.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service("getReportFeeMonthStatisticsBMOImpl") |
| | | public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthStatisticsBMO { |
| | |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IComputeFeeSMO computeFeeSMOImpl; |
| | | |
| | | /** |
| | | * @param reportFeeMonthStatisticsDto |
| | |
| | | reportFeeMonthStatisticsDtos.add(reportFeeMonthStatistics); |
| | | } |
| | | ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryMajor(reportFeeMonthStatisticsDto); |
| | | if(reportFeeMonthStatisticsList != null && reportFeeMonthStatisticsList.size()> 0){ |
| | | for(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsList){ |
| | | if (reportFeeMonthStatisticsList != null && reportFeeMonthStatisticsList.size() > 0) { |
| | | for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsList) { |
| | | reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount()); |
| | | } |
| | | } |
| | |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummary(reportFeeMonthStatisticsDto); |
| | | ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummaryMajor(reportFeeMonthStatisticsDto); |
| | | if(reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size()> 0){ |
| | | for(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos){ |
| | | if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) { |
| | | for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) { |
| | | reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount()); |
| | | } |
| | | } |
| | |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdown(reportFeeMonthStatisticsDto); |
| | | ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdownMajor(reportFeeMonthStatisticsDto); |
| | | if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) { |
| | | for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) { |
| | | reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount()); |
| | | } |
| | | } |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetail(reportFeeMonthStatisticsDto); |
| | | |
| | | ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailMajor(reportFeeMonthStatisticsDto); |
| | | if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) { |
| | | for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) { |
| | | reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount()); |
| | | reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount()); |
| | | } |
| | | } |
| | | freshReportOweDay(reportFeeMonthStatisticsDtos); |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryHuaningOweFee(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeCount(reportFeeMonthStatisticsDto); |
| | | |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFee(reportFeeMonthStatisticsDto); |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryHuaningPayFee(Map paramInfo) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.YEAR, (int) paramInfo.get("year")); |
| | | calendar.set(Calendar.MONTH, (int) paramInfo.get("month") - 1); |
| | | paramInfo.put("yearMonth", DateUtil.getFormatTimeString(calendar.getTime(), "YYYY-MM")); |
| | | calendar.add(Calendar.MONTH, 1); |
| | | paramInfo.put("nextYear", calendar.get(Calendar.YEAR)); |
| | | paramInfo.put("nextMonth", calendar.get(Calendar.MONTH) + 1); |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeCount(paramInfo); |
| | | |
| | | List<Map> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFee(paramInfo); |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryHuaningPayFeeTwo(Map paramInfo) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.YEAR, (int) paramInfo.get("year")); |
| | | calendar.set(Calendar.MONTH, (int) paramInfo.get("month") - 1); |
| | | paramInfo.put("yearMonth", DateUtil.getFormatTimeString(calendar.getTime(), "YYYY-MM")); |
| | | calendar.add(Calendar.MONTH, 1); |
| | | paramInfo.put("nextYear", calendar.get(Calendar.YEAR)); |
| | | paramInfo.put("nextMonth", calendar.get(Calendar.MONTH) + 1); |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeTwoCount(paramInfo); |
| | | |
| | | List<Map> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeTwo(paramInfo); |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryHuaningOweFeeDetail(Map paramInfo) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetailCount(paramInfo); |
| | | List<Map> reportFeeMonthStatisticsDtos = null; |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetail(paramInfo); |
| | | refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo); |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | private void refreshOweFee(List<Map> reportFeeMonthStatisticsDtos, Map paramInfo) { |
| | | Date startTime = null; |
| | | Date endTime = null; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int curMonth = calendar.get(Calendar.MONTH) + 1; |
| | | calendar.set(Calendar.MONTH, 0); |
| | | Date curStart = calendar.getTime(); |
| | | |
| | | |
| | | for (Map paramIn : reportFeeMonthStatisticsDtos) { |
| | | |
| | | startTime = (Date) paramIn.get("startTime"); |
| | | endTime = (Date) paramIn.get("startTime"); |
| | | BigDecimal money = (BigDecimal) paramIn.get("oweAmount"); |
| | | double month = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, endTime)); |
| | | if (month < 1) { |
| | | paramIn.put("btAmount", 0); |
| | | paramIn.put("bfAmount", 0); |
| | | continue; |
| | | } |
| | | |
| | | //每月金额 |
| | | BigDecimal monthAmount = money.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | |
| | | if (startTime.getTime() < curStart.getTime()) { |
| | | BigDecimal btAmountDec = monthAmount.multiply(new BigDecimal(curMonth)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | paramIn.put("btAmount", btAmountDec.doubleValue()); |
| | | double preMonth = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, curStart)); |
| | | BigDecimal bfAmountDec = monthAmount.multiply(new BigDecimal(preMonth)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | paramIn.put("bfAmount", bfAmountDec.doubleValue()); |
| | | continue; |
| | | } |
| | | |
| | | if (startTime.getTime() >= curStart.getTime()) { |
| | | paramIn.put("btAmount", money.doubleValue()); |
| | | paramIn.put("bfAmount", 0); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryPrePayment(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { |
| | | |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPrePaymentNewCount(reportFeeMonthStatisticsDto); |