| @@ -11,6 +11,7 @@ import com.iformall.domain.vo.WxBillFeesStandardsListVo; | |||||
| import com.iformall.enums.EnumBillAction; | import com.iformall.enums.EnumBillAction; | ||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumBillStatus; | import com.iformall.enums.EnumBillStatus; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -105,6 +106,14 @@ public class WxAllBill extends TenantEntity { | |||||
| @Excel(name = "周期开始时间", format = "yyyy-MM-dd", width = 20, orderNum = "4") | @Excel(name = "周期开始时间", format = "yyyy-MM-dd", width = 20, orderNum = "4") | ||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | @io.swagger.annotations.ApiModelProperty(value="开始时间",name="starttime") | ||||
| public Date starttime; | public Date starttime; | ||||
| @TableField(exist = false) | |||||
| private String starttimeStr; | |||||
| public String getStarttimeStr() { | |||||
| if (null != starttime) { | |||||
| starttimeStr = DateUtils.date2String(starttime); | |||||
| } | |||||
| return starttimeStr; | |||||
| } | |||||
| @Excel(name = "周期结束时间", format = "yyyy-MM-dd", width = 20, orderNum = "5") | @Excel(name = "周期结束时间", format = "yyyy-MM-dd", width = 20, orderNum = "5") | ||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime") | ||||
| @@ -113,6 +122,14 @@ public class WxAllBill extends TenantEntity { | |||||
| public Date endtimeBegin; | public Date endtimeBegin; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| public Date endtimeEnd; | public Date endtimeEnd; | ||||
| @TableField(exist = false) | |||||
| private String endtimeStr; | |||||
| public String getEndtimeStr() { | |||||
| if (null != endtime) { | |||||
| endtimeStr = DateUtils.date2String(endtime); | |||||
| } | |||||
| return endtimeStr; | |||||
| } | |||||
| @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") | @Excel(name = "欠缴金额(元)", width = 20, orderNum = "11") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumBillAllType; | import com.iformall.enums.EnumBillAllType; | ||||
| import com.iformall.enums.EnumContractReceivePeriodUnit; | |||||
| import com.iformall.enums.EnumEnergyPublicCalcuteRule; | import com.iformall.enums.EnumEnergyPublicCalcuteRule; | ||||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | ||||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | import com.iformall.enums.EnumFeesStandardsTimeUnit; | ||||
| @@ -19,6 +20,7 @@ import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Calendar; | import java.util.Calendar; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -118,7 +120,8 @@ public class WxEnergyFees extends TenantEntity { | |||||
| return ""; | return ""; | ||||
| } | } | ||||
| public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays ) { | |||||
| public String calcuteTotalMoney(Integer decimalSize,Date start,Date end,String count,boolean isFixed,EnumRentDayPriceCalcute priceCalcute,Integer monthDays, | |||||
| EnumContractReceivePeriodUnit dayType,Integer receivePeriod ) { | |||||
| if (StringUtils.isBlank(count)) { | if (StringUtils.isBlank(count)) { | ||||
| count = "1"; | count = "1"; | ||||
| } | } | ||||
| @@ -141,47 +144,7 @@ public class WxEnergyFees extends TenantEntity { | |||||
| priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | priceMonth = new BigDecimal(price).divide(new BigDecimal(12),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | ||||
| } | } | ||||
| priceMonth = priceMonth.multiply(new BigDecimal(count)); | priceMonth = priceMonth.multiply(new BigDecimal(count)); | ||||
| //如果开始时间是1号,结束时间是当月最后一天,则是整月,*月数。 | |||||
| //如果不是整月,跨月了的,则计算: 开始时间到当月底+ 中间整月 + 结束时间月1号到结束时间 | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| Date startMonthFirstDay = DateUtils.getFirstDayForCurrMonth(start); | |||||
| Date endMonthLastDay = DateUtils.getLastDayForMonth(end); | |||||
| if(sd.format(start).equals(sd.format(startMonthFirstDay)) && sd.format(end).equals(sd.format(endMonthLastDay)) ){ | |||||
| int months = WxRentContractHelper.getMonths(sd.format(start),sd.format(end)); | |||||
| months++; | |||||
| if (months > 0 ) { | |||||
| return priceMonth.multiply(new BigDecimal(months)).toPlainString(); | |||||
| }else { | |||||
| return priceMonth.toPlainString(); | |||||
| } | |||||
| }else { | |||||
| Date startMonthEndDay = DateUtils.getLastDayForMonth(start); | |||||
| int startDays = DateUtils.daysBetween(start, startMonthEndDay)+1; | |||||
| int startMonthDays = DateUtils.daysBetween(startMonthFirstDay, startMonthEndDay)+1; | |||||
| Date endMontFirstDay = DateUtils.getFirstDayForCurrMonth(end); | |||||
| int endDays = DateUtils.daysBetween(endMontFirstDay, end)+1; | |||||
| int endMonthDays = DateUtils.daysBetween(endMontFirstDay, endMonthLastDay)+1; | |||||
| int months = WxRentContractHelper.getMonths(sd.format(DateUtils.getDaySet(startMonthEndDay, Calendar.DATE, 1)),sd.format(DateUtils.getDaySet(endMontFirstDay, Calendar.DATE, -1))); | |||||
| months++; | |||||
| if (startDays > 0 ) { | |||||
| priceMonth = priceMonth.multiply(new BigDecimal(startDays)).divide(new BigDecimal(startMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||||
| } | |||||
| if (endDays > 0 ) { | |||||
| priceMonth = priceMonth.multiply(new BigDecimal(endDays)).divide(new BigDecimal(endMonthDays),Constant.default_long_decimal_size,BigDecimal.ROUND_HALF_UP); | |||||
| } | |||||
| if (months > 0 ) { | |||||
| priceMonth = priceMonth.multiply(new BigDecimal(months)); | |||||
| } | |||||
| return priceMonth.toPlainString(); | |||||
| } | |||||
| return WxRentContractHelper.getMonthNeedPay(null,decimalSize,priceMonth, start, end,dayType.getCode(),receivePeriod,priceCalcute.getCode(),monthDays); | |||||
| } | } | ||||
| } | } | ||||
| @@ -411,7 +411,7 @@ public class WxRentContractHelper { | |||||
| if (null != fees.getCalcuteUnit() && fees.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { | if (null != fees.getCalcuteUnit() && fees.getCalcuteUnit().intValue() == EnumFeesStandardsCalcuteUnit.MM.getCode().intValue()) { | ||||
| count = rentArea; | count = rentArea; | ||||
| } | } | ||||
| vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, count,true,null,null)); | |||||
| vo.setTotal(fees.calcuteTotalMoney(decimalSize, billStartDate, billEndDate, count,true,null,null,null,null)); | |||||
| vo.setReceiveDate(DateUtils.getDaySet(billStartDate,Calendar.DATE,-1)); | vo.setReceiveDate(DateUtils.getDaySet(billStartDate,Calendar.DATE,-1)); | ||||
| vo.setFeeStandards(fees); | vo.setFeeStandards(fees); | ||||
| retList.add(vo); | retList.add(vo); | ||||
| @@ -889,11 +889,14 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| WxBillFeesStandardsListVo bfsvo = unFixedList.get(j); | WxBillFeesStandardsListVo bfsvo = unFixedList.get(j); | ||||
| WxEnergyFees feeStandars = bfsvo.getFeeStandards(); | WxEnergyFees feeStandars = bfsvo.getFeeStandards(); | ||||
| if(EnumFeesStandardsCalcuteUnit.MM.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { | if(EnumFeesStandardsCalcuteUnit.MM.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { | ||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,wxPropertyContract.getRentArea(),false,dayPrice,wxPropertyContract.getMonthAverageDays())); | |||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,wxPropertyContract.getRentArea(),false,dayPrice, | |||||
| wxPropertyContract.getMonthAverageDays(),EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); | |||||
| }else if (EnumFeesStandardsCalcuteUnit.HU.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { | }else if (EnumFeesStandardsCalcuteUnit.HU.getCode().intValue() == feeStandars.getCalcuteUnit().intValue()) { | ||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays())); | |||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays(), | |||||
| EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); | |||||
| }else { | }else { | ||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays())); | |||||
| bfsvo.setTotal(feeStandars.calcuteTotalMoney(wxPropertyContract.getDecimalSize(), start, end,"1",false,dayPrice,wxPropertyContract.getMonthAverageDays(), | |||||
| EnumContractReceivePeriodUnit.getEnum(wxPropertyContract.getReceivePeriodUnit()),wxPropertyContract.getReceivePeriod())); | |||||
| } | } | ||||
| bfsvo.setStart(start); | bfsvo.setStart(start); | ||||
| bfsvo.setEnd(end); | bfsvo.setEnd(end); | ||||