| | |
| | | package com.java110.core.smo.impl; |
| | | |
| | | import com.java110.config.properties.code.Java110Properties; |
| | | import com.java110.core.context.Environment; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.contract.ContractDto; |
| | | import com.java110.dto.contractRoom.ContractRoomDto; |
| | | import com.java110.dto.fee.*; |
| | | import com.java110.dto.machine.CarInoutDetailDto; |
| | | import com.java110.dto.machine.CarInoutDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.fee.ITempCarFeeConfigAttrInnerServiceSMO; |
| | | import com.java110.intf.fee.ITempCarFeeConfigInnerServiceSMO; |
| | | import com.java110.intf.store.IContractInnerServiceSMO; |
| | | import com.java110.intf.store.IContractRoomInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired(required = false) |
| | | private IContractInnerServiceSMO contractInnerServiceSMOImpl; |
| | | |
| | | @Autowired(required = false) |
| | | private ITempCarFeeConfigInnerServiceSMO tempCarFeeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired(required = false) |
| | | private ITempCarFeeConfigAttrInnerServiceSMO tempCarFeeConfigAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private Java110Properties java110Properties; |
| | | |
| | | @Override |
| | | public Date getFeeEndTime() { |
| | | return null; |
| | |
| | | public void computeEveryOweFee(FeeDto tmpFeeDto, RoomDto roomDto) { |
| | | computeFeePrice(tmpFeeDto, roomDto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算欠费金额 |
| | |
| | | } |
| | | |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | double feePrice = getFeePrice(feeDto); |
| | | Map feePriceAll = getFeePrice(feeDto); |
| | | |
| | | feeDto.setFeePrice(feePrice); |
| | | feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString())); |
| | | BigDecimal price = new BigDecimal(feeDto.getFeePrice()); |
| | | price = price.multiply(new BigDecimal(oweMonth)); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | feeDto.setDeadlineTime(targetEndDate); |
| | | |
| | | //动态费用 |
| | |
| | | double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth"); |
| | | |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | double feePrice = getFeePrice(feeDto, roomDto); |
| | | feeDto.setFeePrice(feePrice); |
| | | Map feePriceAll = getFeePrice(feeDto, roomDto); |
| | | feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString())); |
| | | //double month = dayCompare(feeDto.getEndTime(), DateUtil.getCurrentDate()); |
| | | BigDecimal price = new BigDecimal(feeDto.getFeePrice()); |
| | | price = price.multiply(new BigDecimal(oweMonth)); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | feeDto.setDeadlineTime(targetEndDate); |
| | | |
| | | //动态费用 |
| | |
| | | double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth"); |
| | | |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | double feePrice = getFeePrice(feeDto, roomDto); |
| | | feeDto.setFeePrice(feePrice); |
| | | Map feePriceAll = getFeePrice(feeDto, roomDto); |
| | | feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString())); |
| | | //double month = dayCompare(feeDto.getEndTime(), DateUtil.getCurrentDate()); |
| | | BigDecimal price = new BigDecimal(feeDto.getFeePrice()); |
| | | price = price.multiply(new BigDecimal(oweMonth)); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | feeDto.setFeePrice(price.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | feeDto.setDeadlineTime(targetEndDate); |
| | | |
| | | //动态费用 |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { //租金 |
| | | feeReceiptDetailPo.setArea(roomDtos.get(0).getBuiltUpArea()); |
| | | feeReceiptDetailPo.setSquarePrice(roomDtos.get(0).getRoomRent()); |
| | | } else { |
| | | } |
| | | } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//车位相关 |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getSquarePrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(reportRoomDto.getBuiltUpArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("3003".equals(computingFormula)) { // 固定费用 |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("4004".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); |
| | | } else if ("5005".equals(computingFormula)) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("0")); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("3003".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | feePrice = new BigDecimal(0); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | | } |
| | | return feePrice.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | return feePrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | @Override |
| | | public double getFeePrice(FeeDto feeDto) { |
| | | public Map getFeePrice(FeeDto feeDto) { |
| | | return getFeePrice(feeDto, null); |
| | | } |
| | | |
| | | @Override |
| | | public double getFeePrice(FeeDto feeDto, RoomDto roomDto) { |
| | | BigDecimal feePrice = new BigDecimal(0.0); |
| | | public Map getFeePrice(FeeDto feeDto, RoomDto roomDto) { |
| | | BigDecimal feePrice = new BigDecimal("0.0"); |
| | | BigDecimal feeTotalPrice = new BigDecimal(0.0); |
| | | Map<String, Object> feeAmount = new HashMap<>(); |
| | | if (Environment.isOwnerPhone(java110Properties)) { |
| | | return getOwnerPhoneFee(feeAmount); |
| | | } |
| | | if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //房屋相关 |
| | | String computingFormula = feeDto.getComputingFormula(); |
| | | if (roomDto == null) { |
| | |
| | | roomDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | if (roomDtos == null || roomDtos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查到房屋信息,查询多条数据"); |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查到房屋信息,查询多条数据 roomId=" + feeDto.getPayerObjId()); |
| | | } |
| | | roomDto = roomDtos.get(0); |
| | | } |
| | |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getBuiltUpArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("3003".equals(computingFormula)) { // 固定费用 |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("4004".equals(computingFormula)) { //动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { //(本期度数-上期度数)*单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeRoomCustomizeFormula(feeDto, roomDto); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("3003".equals(computingFormula)) { // 固定费用 |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("4004".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0)); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | |
| | | } |
| | | feeDto.setBuiltUpArea(builtUpArea.doubleValue() + ""); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("2002".equals(computingFormula)) { // 固定费用 |
| | | //feePrice = Double.parseDouble(feeDto.getAdditionalAmount()); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | // BigDecimal roomDount = new BigDecimal(contractRoomDtos.size()); |
| | | // additionalAmount = additionalAmount.multiply(roomDount); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("3003".equals(computingFormula)) { // 固定费用 |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getRoomArea())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_EVEN); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = additionalAmount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("4004".equals(computingFormula)) { //动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { //(本期度数-上期度数)*单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = feePrice.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | BigDecimal amount = new BigDecimal(feeDto.getAmount()); |
| | | feeTotalPrice = amount.multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | BigDecimal cycle1 = new BigDecimal(feeDto.getCycle()); |
| | | feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle1).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | | } |
| | | return feePrice.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | feePrice.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | feeAmount.put("feePrice", feePrice); |
| | | feeAmount.put("feeTotalPrice", feeTotalPrice); |
| | | return feeAmount; |
| | | } |
| | | |
| | | /** |
| | |
| | | return resMonth; |
| | | } |
| | | |
| | | |
| | | //手机端缴费处理 |
| | | public Map getOwnerPhoneFee(Map feeAmount) { |
| | | feeAmount.put("feePrice", new BigDecimal(1.00 / 100)); |
| | | feeAmount.put("feeTotalPrice", new BigDecimal(1.00 / 100)); |
| | | return feeAmount; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * *字符串的日期格式的计算 |
| | | */ |
| | | public long daysBetween(Date smdate, Date bdate) { |
| | | long between_days = 0; |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(smdate); |
| | | long time1 = cal.getTimeInMillis(); |
| | | cal.setTime(bdate); |
| | | long time2 = cal.getTimeInMillis(); |
| | | between_days = (time2 - time1) / (1000 * 3600 * 24); |
| | | |
| | | return between_days; |
| | | } |
| | | |
| | | @Override |
| | | public Date getTargetEndTime(double month, Date startDate) { |
| | | Calendar endDate = Calendar.getInstance(); |
| | |
| | | return endDate.getTime(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | ComputeFeeSMOImpl computeFeeSMO = new ComputeFeeSMOImpl(); |
| | | try { |
| | | double month = computeFeeSMO.dayCompare( |
| | | DateUtil.getDateFromString("2021-6-1 00:00:00", DateUtil.DATE_FORMATE_STRING_A), |
| | | DateUtil.getDateFromString("2021-8-5 18:00:00", DateUtil.DATE_FORMATE_STRING_A) |
| | | ); |
| | | System.out.println(month); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | |
| | | @Override |
| | | public List<CarInoutDto> computeTempCarStopTimeAndFee(List<CarInoutDto> carInoutDtos) { |
| | | |
| | | if (carInoutDtos == null || carInoutDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarFee(carInoutDtos); |
| | | |
| | | return carInoutDtos; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<CarInoutDetailDto> computeTempCarInoutDetailStopTimeAndFee(List<CarInoutDetailDto> carInoutDtos) { |
| | | if (carInoutDtos == null || carInoutDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarInoutDetailFee(carInoutDtos); |
| | | |
| | | return carInoutDtos; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble("4.50")); |
| | | BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("52.69")); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble("0")); |
| | | BigDecimal cycle = new BigDecimal(Double.parseDouble("3")); |
| | | BigDecimal feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_DOWN); |
| | | System.out.println(feeTotalPrice.doubleValue()); |
| | | } |
| | | |
| | | // public static void main(String[] args) { |