| | |
| | | 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; |
| | |
| | | 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | if (roomDto == null) { |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = feePrice.multiply(cycle).setScale(4, 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(4, 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(4, 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(4, 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(4, 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()); |
| | |
| | | if(cycle == null){ |
| | | feeTotalPrice = new BigDecimal(0); |
| | | }else { |
| | | feeTotalPrice = additionalAmount.multiply(cycle).setScale(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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(4, BigDecimal.ROUND_HALF_UP); |
| | | feeTotalPrice = sub.multiply(squarePrice).add(additionalAmount).multiply(cycle).setScale(FeeConfigConstant.FEE_SCALE, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | feePrice.setScale(4, 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; |
| | |
| | | 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; |
| | | } |