| @@ -254,12 +254,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| * @param revenueLong | * @param revenueLong | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static Long countPrice(Integer ratio,Long revenueLong){ | |||||
| public static Long countPrice(Integer ratio,Long revenueLong,int timeType,int period){ | |||||
| BigDecimal hundred = new BigDecimal(100); | BigDecimal hundred = new BigDecimal(100); | ||||
| BigDecimal revenue = new BigDecimal(revenueLong == null ? 0 : revenueLong).divide(hundred); | BigDecimal revenue = new BigDecimal(revenueLong == null ? 0 : revenueLong).divide(hundred); | ||||
| BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); | BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); | ||||
| BigDecimal price; | BigDecimal price; | ||||
| price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | |||||
| if(EnumMissTimeType.YEAR.getCode().equals(timeType)){ | |||||
| price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);;; | |||||
| }else if(EnumMissTimeType.PERIOD.getCode().equals(timeType)){ | |||||
| price = revenue.multiply(new BigDecimal(period)).multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);; | |||||
| }else if(EnumMissTimeType.MONTH.getCode().equals(timeType)){ | |||||
| price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | |||||
| }else{ | |||||
| price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); | |||||
| } | |||||
| return price.multiply(hundred).longValue(); | return price.multiply(hundred).longValue(); | ||||
| } | } | ||||
| @@ -307,7 +315,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | if (revenue.compareTo(start) >= 0 && revenue.compareTo(end)<= 0){ | ||||
| ratioVo.setRatio(ratio); | ratioVo.setRatio(ratio); | ||||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong)); | |||||
| ratioVo.setPrice(countPrice(ratioVo.getRatio(),revenueLong,timeType,period)); | |||||
| break; | break; | ||||
| } | } | ||||
| }else if(e.indexOf(">") >= 0){ | }else if(e.indexOf(">") >= 0){ | ||||
| @@ -383,7 +391,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| record.setPrice(0l); | record.setPrice(0l); | ||||
| }else{ | }else{ | ||||
| if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | ||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); | |||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod())); | |||||
| }else{ | }else{ | ||||
| int dayCount = record.getReceivePeriod() * 30; | int dayCount = record.getReceivePeriod() * 30; | ||||
| RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | ||||
| @@ -616,7 +624,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if(!EnumFromType.SWITCH.getCode().equals(from)){ | if(!EnumFromType.SWITCH.getCode().equals(from)){ | ||||
| if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||
| if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ | ||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue())); | |||||
| record.setPrice(countPrice(record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod())); | |||||
| }else{ | }else{ | ||||
| int dayCount = record.getReceivePeriod() * 30; | int dayCount = record.getReceivePeriod() * 30; | ||||
| RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | RatioVo ratioVo = getPayRatio(EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | ||||
| @@ -1248,14 +1256,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| }else{ | }else{ | ||||
| Double priceD = new Double(price); | Double priceD = new Double(price); | ||||
| //年或者设置跳点率为年周期 除12 | |||||
| //年 除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ | if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ | ||||
| priceD = new Double(price)/12; | priceD = new Double(price)/12; | ||||
| } | } | ||||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||
| //设置跳点率为年周期 price不变 | //设置跳点率为年周期 price不变 | ||||
| if(EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | if(EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | ||||
| return priceD.longValue(); | |||||
| if(i == billTimeVoListSize - 1){ | |||||
| priceD = new Double(price); | |||||
| }else { | |||||
| return priceD.longValue(); | |||||
| } | |||||
| } | } | ||||
| //年或者设置跳点率为年周期 除12 | //年或者设置跳点率为年周期 除12 | ||||
| if(EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | if(EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | ||||