| | |
| | | import com.java110.core.context.Environment; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.RoomAttrDto; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.contract.ContractDto; |
| | |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo; |
| | | import com.java110.utils.constant.FeeConfigConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | |
| | | endCalender.setTime(feeDto.getImportFeeEndTime()); |
| | | } |
| | | } else if(FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeDto.getFeeFlag())){ |
| | | if(feeDto.getDeadlineTime() == null){ |
| | | throw new IllegalArgumentException("间接性费用未设置结束时间"); |
| | | } |
| | | if ((endCalender.getTime()).after(feeDto.getDeadlineTime())) { |
| | | endCalender.setTime(feeDto.getDeadlineTime()); |
| | | } |
| | |
| | | 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, 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_UP); |
| | | feePrice = additionalAmount.setScale(4, 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | } else if ("1102".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(4, 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_UP); |
| | | .setScale(4, 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_UP); |
| | | .setScale(4, 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(4, 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_UP); |
| | | feePrice = additionalAmount.setScale(4, 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_UP); |
| | | .setScale(4, 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_UP); |
| | | .setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | | } |
| | | return feePrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | return feePrice.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | }else if ("1102".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("4004".equals(computingFormula)) { //动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { //(本期度数-上期度数)*单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | if (roomDto == null) { |
| | | roomDto = new RoomDto(); |
| | | roomDto.setRoomId(feeDto.getPayerObjId()); |
| | | roomDto.setCommunityId(feeDto.getCommunityId()); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | if (roomDtos == null || roomDtos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查到房屋信息,查询多条数据 roomId=" + feeDto.getPayerObjId()); |
| | | } |
| | | roomDto = roomDtos.get(0); |
| | | } |
| | | feePrice = computeRoomCustomizeFormula(feeDto, roomDto); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = additionalAmount.setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1102".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | }else if ("4004".equals(computingFormula)) { |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0)); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | } |
| | | feeDto.setBuiltUpArea(builtUpArea.doubleValue() + ""); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | | cycle = new BigDecimal(feeDto.getCycle()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, 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_UP); |
| | | feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("1101".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | }else if ("1102".equals(computingFormula)) { // 租金 |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(roomDto.getRoomRent())); |
| | | feePrice = additionalAmount.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feePrice = additionalAmount.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("4004".equals(computingFormula)) { //动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("5005".equals(computingFormula)) { //(本期度数-上期度数)*单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | |
| | | BigDecimal cycle = null; |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = (sub.multiply(squarePrice).add(additionalAmount)).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else if ("6006".equals(computingFormula)) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | .setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | BigDecimal cycle = null; |
| | | if (!StringUtil.isEmpty(feeDto.getCycle())) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | feePrice.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | feePrice.setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | feeAmount.put("feePrice", feePrice); |
| | | feeAmount.put("feeTotalPrice", feeTotalPrice); |
| | | return feeAmount; |
| | |
| | | private BigDecimal computeRoomCustomizeFormula(FeeDto feeDto, RoomDto roomDto) { |
| | | |
| | | String value = feeDto.getComputingFormulaText(); |
| | | |
| | | if(StringUtil.isEmpty(value)){ |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | value = value.replace("\n", "") |
| | | .replace("\r", "") |
| | | .trim(); |
| | |
| | | value = value.replace("F", roomDto.getFloorArea()); |
| | | } else if (value.contains("U")) { //处理单元 |
| | | value = value.replace("U", roomDto.getUnitArea()); |
| | | } else if (value.contains("RL")){ |
| | | List<RoomAttrDto> roomAttrDtos = roomDto.getRoomAttrDto(); |
| | | if(roomAttrDtos != null && roomAttrDtos.size() > 0){ |
| | | for(RoomAttrDto roomAttrDto : roomAttrDtos){ |
| | | value = value.replace("RL"+roomAttrDto.getSpecCd(), roomAttrDto.getValue()); |
| | | } |
| | | } |
| | | } else if (value.contains("R")) { //处理 房屋面积 |
| | | value = value.replace("R", roomDto.getBuiltUpArea()); |
| | | } else if (value.contains("X")) {// 处理 房屋系数 |
| | |
| | | BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice()); |
| | | if (feeDto.getEndTime().getTime() < rateStartTime.getTime()) { |
| | | curOweMonth = dayCompare(feeDto.getEndTime(), rateStartTime); |
| | | oweAmountDec = curFeePrice.multiply(new BigDecimal(curOweMonth)).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | oweAmountDec = curFeePrice.multiply(new BigDecimal(curOweMonth)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | |
| | | curOweMonth = dayCompare(rateStartTime, feeDto.getDeadlineTime()); |
| | |
| | | Date curEndTime = null; |
| | | for (int cycleIndex = 0; cycleIndex < maxCycle; cycleIndex++) { |
| | | //当期增长部分 |
| | | rateDec = preCycleAmount.multiply(new BigDecimal(rate)).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | rateDec = preCycleAmount.multiply(new BigDecimal(rate)).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | //增长周期的倍数 |
| | | curCycle = (cycleIndex + 1) * rateCycle; |
| | | |
| | |
| | | curEndTime = curEndTimeCalender.getTime(); |
| | | if (curCycle > curOweMonth) { |
| | | //不足增长周期增长率 |
| | | rateDec = new BigDecimal(curOweMonth / rateCycle - Math.floor(curOweMonth / rateCycle)).multiply(rateDec).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | lastRateAmountDec = new BigDecimal(curOweMonth / rateCycle - Math.floor(curOweMonth / rateCycle)).multiply(preCycleAmount).setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | rateDec = new BigDecimal(curOweMonth / rateCycle - Math.floor(curOweMonth / rateCycle)).multiply(rateDec).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | lastRateAmountDec = new BigDecimal(curOweMonth / rateCycle - Math.floor(curOweMonth / rateCycle)).multiply(preCycleAmount).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | addTotalAmount = addTotalAmount.add(rateDec).add(lastRateAmountDec); |
| | | continue; |
| | | } |