| | |
| | | package com.java110.report.bmo.reportFeeMonthStatistics.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.repair.RepairDto; |
| | | import com.java110.dto.repair.RepairUserDto; |
| | | import com.java110.dto.report.ReportDeposit; |
| | | import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto; |
| | | import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsTotalDto; |
| | | import com.java110.intf.community.IRepairInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.report.bmo.reportFeeMonthStatistics.IGetReportFeeMonthStatisticsBMO; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @Service("getReportFeeMonthStatisticsBMOImpl") |
| | |
| | | |
| | | @Autowired |
| | | private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRepairInnerServiceSMO repairInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * @param reportFeeMonthStatisticsDto |
| | |
| | | public ResponseEntity<String> queryReportFeeSummary(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryCount(reportFeeMonthStatisticsDto); |
| | | |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null; |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | if (count > 0) { |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummary(reportFeeMonthStatisticsDto); |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummary(reportFeeMonthStatisticsDto); |
| | | for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsList) { |
| | | //获取应收金额 |
| | | double receivableAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivableAmount()); |
| | | //获取实收金额 |
| | | double receivedAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivedAmount()); |
| | | double chargeRate = (receivedAmount / receivableAmount) * 100.0; |
| | | reportFeeMonthStatistics.setChargeRate(String.format("%.2f", chargeRate) + "%"); |
| | | reportFeeMonthStatisticsDtos.add(reportFeeMonthStatistics); |
| | | } |
| | | } else { |
| | | reportFeeMonthStatisticsDtos = new ArrayList<>(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryPayFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { |
| | | |
| | | JSONObject countInfo = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailCount(reportFeeMonthStatisticsDto); |
| | | |
| | | int count = Integer.parseInt(countInfo.get("count").toString()); |
| | |
| | | Double allVacantHousingDiscount = 0.0; |
| | | //空置房减免(大计) |
| | | Double allVacantHousingReduction = 0.0; |
| | | int size = 0; |
| | | if (count > 0) { |
| | | //查询缴费明细 |
| | | reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto); |
| | | if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) { |
| | | //查询所有缴费明细记录 |
| | | ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 = BeanConvertUtil.covertBean(reportFeeMonthStatisticsDto, ReportFeeMonthStatisticsDto.class); |
| | | reportFeeMonthStatisticsDto1.setPage(PageDto.DEFAULT_PAGE); |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos1 = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto1); |
| | | size = reportFeeMonthStatisticsDtos1.size(); |
| | | } |
| | | //查询应收、实收总金额(大计) |
| | | List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllPayFeeDetail(reportFeeMonthStatisticsDto); |
| | | //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额 |
| | |
| | | reportFeeMonthStatistics.setPreferentialAmount(reportFeeMonthStatistics.getDiscountPrice()); |
| | | } else { |
| | | reportFeeMonthStatistics.setPreferentialAmount("0"); |
| | | |
| | | } |
| | | //减免金额 |
| | | if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("2")) { |
| | |
| | | } else { |
| | | reportFeeMonthStatistics.setVacantHousingReduction("0"); |
| | | } |
| | | |
| | | if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(reportFeeMonthStatistics.getPayerObjType())) { |
| | | reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getFloorNum() |
| | | + "栋" + reportFeeMonthStatistics.getUnitNum() |
| | | + "单元" + reportFeeMonthStatistics.getRoomNum() + "室"); |
| | | } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(reportFeeMonthStatistics.getPayerObjType())) { |
| | | reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getCarNum()); |
| | | }else{ |
| | | } else { |
| | | reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getContractCode()); |
| | | |
| | | } |
| | | |
| | | if (!StringUtil.isEmpty(reportFeeMonthStatistics.getImportFeeName())) { |
| | | reportFeeMonthStatistics.setFeeName(reportFeeMonthStatistics.getImportFeeName()); |
| | | } |
| | | |
| | | //费用项目 |
| | | reportFeeMonthStatistics.setFeeConfigDtos(feeConfigDtos); |
| | | if (!StringUtil.isEmpty(reportFeeMonthStatistics.getRepairId())) { |
| | | RepairDto repairDto = new RepairDto(); |
| | | repairDto.setRepairId(reportFeeMonthStatistics.getRepairId()); |
| | | //查询报修单 |
| | | List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto); |
| | | Assert.listOnlyOne(repairDtos, "查询报修单错误!"); |
| | | if (!StringUtil.isEmpty(repairDtos.get(0).getRepairObjType()) && repairDtos.get(0).getRepairObjType().equals("004")) { |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(repairDtos.get(0).getRepairObjId()); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | Assert.listOnlyOne(ownerRoomRelDtos, "查询业主房屋关系表错误!"); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId()); |
| | | ownerDto.setOwnerTypeCd("1001"); //业主本人 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto); |
| | | Assert.listOnlyOne(ownerDtos, "查询业主信息错误!"); |
| | | reportFeeMonthStatistics.setOwnerName(ownerDtos.get(0).getName()); |
| | | } |
| | | } |
| | | reportList.add(reportFeeMonthStatistics); |
| | | } |
| | | //应收总金额(小计) |
| | |
| | | reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportList, reportFeeMonthStatisticsTotalDto); |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) size / (double) reportFeeMonthStatisticsDto.getRow()), size, reportList, reportFeeMonthStatisticsTotalDto); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询报表专家 统计信息 |
| | | * |
| | | * @param reportFeeMonthStatisticsDto |
| | | * @return |
| | | */ |
| | |
| | | int transferOrderNumber = 0; |
| | | //派单总数量 |
| | | int dispatchNumber = 0; |
| | | //已回访总数量 |
| | | int returnNumber = 0; |
| | | if (count > 0) { |
| | | for (RepairUserDto repairUser : repairUsers) { |
| | | RepairUserDto repairUserInfo = new RepairUserDto(); |
| | |
| | | int transferOrderAmount = 0; |
| | | //派单数量 |
| | | int dispatchAmount = 0; |
| | | //回访数量 |
| | | int returnAmount = 0; |
| | | //评分 |
| | | String score = ""; |
| | | for (RepairUserDto repair : repairUserDtoList) { |
| | | //处理中状态 |
| | | if (repair.getState().equals("10001")) { |
| | |
| | | } else if (repair.getState().equals("10006")) { //派单状态 |
| | | int amount = Integer.parseInt(repair.getAmount()); |
| | | dispatchAmount = dispatchAmount + amount; |
| | | } else if (repair.getState().equals("10008")) { //已回访状态 |
| | | int amount = Integer.parseInt(repair.getAmount()); |
| | | returnAmount = returnAmount + amount; |
| | | } |
| | | if (!StringUtil.isEmpty(repair.getScore())) { |
| | | score = repair.getScore(); |
| | | } |
| | | } |
| | | //员工id |
| | |
| | | repairUserInfo.setDispatchAmount(Integer.toString(dispatchAmount)); |
| | | //派单报修总数量 |
| | | repairUserInfo.setDispatchNumber(Integer.toString(dispatchNumber)); |
| | | //回访数量 |
| | | repairUserInfo.setReturnAmount(Integer.toString(returnAmount)); |
| | | //回访总数量 |
| | | repairUserInfo.setReturnNumber(Integer.toString(returnNumber)); |
| | | //员工id和姓名信息集合 |
| | | repairUserInfo.setRepairList(staffs); |
| | | //员工评分 |
| | | repairUserInfo.setScore(score); |
| | | repairUserList.add(repairUserInfo); |
| | | } else { |
| | | continue; |
| | |
| | | chargebackNumber = Integer.parseInt(repairUserInfo.getChargebackAmount()) + chargebackNumber; |
| | | transferOrderNumber = Integer.parseInt(repairUserInfo.getTransferOrderAmount()) + transferOrderNumber; |
| | | dispatchNumber = Integer.parseInt(repairUserInfo.getDispatchAmount()) + dispatchNumber; |
| | | returnNumber = Integer.parseInt(repairUserInfo.getReturnAmount()) + returnNumber; |
| | | } |
| | | } else { |
| | | repairUserList = new ArrayList<>(); |
| | |
| | | repairUser.setChargebackNumber(Integer.toString(chargebackNumber)); |
| | | repairUser.setTransferOrderNumber(Integer.toString(transferOrderNumber)); |
| | | repairUser.setDispatchNumber(Integer.toString(dispatchNumber)); |
| | | repairUser.setReturnNumber(Integer.toString(returnNumber)); |
| | | |
| | | //获取总条数 |
| | | int size = staffs.size(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryPayFeeDeposit(ReportDeposit reportDeposit) { |
| | | //查询押金 |
| | | List<ReportDeposit> reportDeposits = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDeposit(reportDeposit); |
| | | //查询押金退费总金额 |
| | | List<ReportDeposit> reportDepositAmounts = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDepositAmount(reportDeposit); |
| | | |
| | | //查询押金费用项 |
| | | FeeConfigDto feeConfigDto = new FeeConfigDto(); |
| | | feeConfigDto.setCommunityId(reportDeposit.getCommunityId()); |
| | | feeConfigDto.setFeeTypeCd("888800010006"); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); |
| | | |
| | | List<ReportDeposit> newReportDeposits = new ArrayList<>(); |
| | | BigDecimal unpaidfeeAmount = new BigDecimal(0);//未交费 |
| | | BigDecimal unpaidfeeAmounts = new BigDecimal(0);//未缴费总金额 |
| | | BigDecimal paidfeeAmount = new BigDecimal(0);//已缴费 |
| | | BigDecimal paidfeeAmounts = new BigDecimal(0);//已缴费总金额 |
| | | BigDecimal refundedAmount = new BigDecimal(0);//已退费 |
| | | BigDecimal refundedAmounts = new BigDecimal(0);//已退费总金额 |
| | | BigDecimal refundInProgressAmount = new BigDecimal(0); //退费中 |
| | | BigDecimal refundInProgressAmounts = new BigDecimal(0);//退费中总金额 |
| | | BigDecimal refundFailedAmount = new BigDecimal(0); //退费失败 |
| | | BigDecimal refundFailedAmounts = new BigDecimal(0);//退费失败总金额 |
| | | for (ReportDeposit deposit : reportDeposits) { |
| | | deposit.setFeeConfigDtos(feeConfigDtos); |
| | | newReportDeposits.add(deposit); |
| | | if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(deposit.getPayerObjType())) { |
| | | deposit.setObjName(deposit.getFloorNum() |
| | | + "栋" + deposit.getUnitNum() |
| | | + "单元" + deposit.getRoomNum() + "室"); |
| | | } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(deposit.getPayerObjType())) { |
| | | deposit.setObjName(deposit.getCarNum()); |
| | | } |
| | | //收费中(未交费) |
| | | if ("2008001".equals(deposit.getState())) { |
| | | unpaidfeeAmount = unpaidfeeAmount.add(new BigDecimal(deposit.getAdditionalAmount())); |
| | | } |
| | | //收费结束(已收费) |
| | | if ("2009001".equals(deposit.getState()) && !StringUtil.isEmpty(deposit.getDetailState()) && "1400".equals(deposit.getDetailState())) { |
| | | paidfeeAmount = paidfeeAmount.add(new BigDecimal(deposit.getAdditionalAmount())); |
| | | } |
| | | if (!StringUtil.isEmpty(deposit.getDetailState()) && "1100".equals(deposit.getDetailState())) {//已退费 |
| | | refundedAmount = refundedAmount.add(new BigDecimal(deposit.getAdditionalAmount())); |
| | | } |
| | | if (!StringUtil.isEmpty(deposit.getDetailState()) && "1000".equals(deposit.getDetailState())) {//退费中 |
| | | refundInProgressAmount = refundInProgressAmount.add(new BigDecimal(deposit.getAdditionalAmount())); |
| | | } |
| | | if (!StringUtil.isEmpty(deposit.getDetailState()) && "1200".equals(deposit.getDetailState())) {//退费失败 |
| | | refundFailedAmount = refundFailedAmount.add(new BigDecimal(deposit.getAdditionalAmount())); |
| | | } |
| | | } |
| | | for (ReportDeposit reportDeposit1 : reportDepositAmounts) { |
| | | if (StringUtil.isEmpty(reportDeposit1.getAllAmount())) { |
| | | throw new IllegalArgumentException("查询总金额错误!"); |
| | | } |
| | | //获取总金额 |
| | | BigDecimal bd = new BigDecimal(reportDeposit1.getAllAmount()); |
| | | if (StringUtil.isEmpty(reportDeposit1.getDetailState())) { //获取未缴费总金额 |
| | | unpaidfeeAmounts = bd; |
| | | } else if (reportDeposit1.getDetailState().equals("1000")) { //获取退费中总金额 |
| | | refundInProgressAmounts = bd; |
| | | } else if (reportDeposit1.getDetailState().equals("1100")) { //获取已退费总金额 |
| | | refundedAmounts = bd; |
| | | } else if (reportDeposit1.getDetailState().equals("1200")) { //获取退费失败总金额 |
| | | refundFailedAmounts = bd; |
| | | } else if (reportDeposit1.getDetailState().equals("1400")) { //获取已缴费总金额 |
| | | paidfeeAmounts = bd; |
| | | } |
| | | } |
| | | HashMap<String, String> mp = new HashMap<>(); |
| | | mp.put("unpaidfeeAmount", unpaidfeeAmount.toString()); |
| | | mp.put("paidfeeAmount", paidfeeAmount.toString()); |
| | | mp.put("refundedAmount", refundedAmount.toString()); |
| | | mp.put("refundInProgressAmount", refundInProgressAmount.toString()); |
| | | mp.put("refundFailedAmount", refundFailedAmount.toString()); |
| | | mp.put("unpaidfeeAmounts", unpaidfeeAmounts.toString()); |
| | | mp.put("paidfeeAmounts", paidfeeAmounts.toString()); |
| | | mp.put("refundedAmounts", refundedAmounts.toString()); |
| | | mp.put("refundInProgressAmounts", refundInProgressAmounts.toString()); |
| | | mp.put("refundFailedAmounts", refundFailedAmounts.toString()); |
| | | int size = 0; |
| | | if (newReportDeposits != null && newReportDeposits.size() > 0) { |
| | | //查询所有条数 |
| | | reportDeposit.setPage(PageDto.DEFAULT_PAGE); |
| | | List<ReportDeposit> reportDeposits1 = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDeposit(reportDeposit); |
| | | size = reportDeposits1.size(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) size / (double) reportDeposit.getRow()), size, newReportDeposits, mp); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | return responseEntity; |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> queryPrePayment(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { |
| | | |
| | | int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPrePaymentNewCount(reportFeeMonthStatisticsDto); |