| @@ -66,6 +66,9 @@ public class WxPropertyContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="付款周期",name="receivePeriod") | |||
| private Integer receivePeriod; | |||
| @io.swagger.annotations.ApiModelProperty(value = "付款周期单位EnumContractReceivePeriodUnit", name = "receivePeriodUnit") | |||
| private Integer receivePeriodUnit; | |||
| @io.swagger.annotations.ApiModelProperty(value="合同文件路径",name="filepath") | |||
| private String filepath; | |||
| @@ -236,6 +236,8 @@ public class WxRentContract extends TenantEntity { | |||
| private Date signDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "付款周期", name = "receivePeriod") | |||
| private Integer receivePeriod; | |||
| @io.swagger.annotations.ApiModelProperty(value = "付款周期单位EnumContractReceivePeriodUnit", name = "receivePeriodUnit") | |||
| private Integer receivePeriodUnit; | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同文件路径", name = "filepath") | |||
| private String filepath; | |||
| @io.swagger.annotations.ApiModelProperty(value = "合同进度状态1待签约2已签约未记租3计租中4提前终止5合同到期", name = "status") | |||
| @@ -0,0 +1,74 @@ | |||
| package com.iformall.enums; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import com.iformall.utils.DateUtils; | |||
| /** | |||
| */ | |||
| public enum EnumContractReceivePeriodUnit { | |||
| MONTH(1, "月"), | |||
| QUARTER(2, "自然季度"); | |||
| public static EnumContractReceivePeriodUnit getEnum(Integer code) { | |||
| for (EnumContractReceivePeriodUnit value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumContractReceivePeriodUnit(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| //截止到后几个季度的时间 | |||
| public static Calendar getAfterCalendarDay(Calendar instance,int period,int unit) { | |||
| if (unit == MONTH.getCode().intValue()) { | |||
| instance.add(Calendar.MONTH, period); | |||
| instance.add(Calendar.DATE, -1); | |||
| //几个季度之后 | |||
| }else if (unit == QUARTER.getCode().intValue()) { | |||
| instance = DateUtils.getAfterQuaterStartDay(instance.getTime(), period); | |||
| instance.add(Calendar.SECOND, -1); | |||
| } | |||
| return instance; | |||
| } | |||
| //截止到后几个季度的时间,自然天 | |||
| public static Date getAfterCalendarNarDay(Date date,int period,int unit) { | |||
| if (unit == MONTH.getCode().intValue()) { | |||
| if (period <= 1) { | |||
| return DateUtils.getLastDayForMonth(date); | |||
| }else { | |||
| Date firstDay = DateUtils.getFirstDayForCurrMonth(date); | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(firstDay); | |||
| instance.add(Calendar.MONTH, period); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| } | |||
| //几个季度之后 | |||
| }else if (unit == QUARTER.getCode().intValue()) { | |||
| Calendar instance = DateUtils.getAfterQuaterStartDay(date, period); | |||
| instance.add(Calendar.SECOND, -1); | |||
| return instance.getTime(); | |||
| } | |||
| return date; | |||
| } | |||
| } | |||
| @@ -306,19 +306,24 @@ public class WxBillRentServiceImpl extends WxBillBaseService implements WxBillRe | |||
| if(EnumBusRatioTime.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | |||
| if(startInt == endInt && months == 12){ | |||
| //刚好1年 | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), | |||
| wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null); | |||
| }else{ | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0); | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), | |||
| wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.YEAR.getCode(),dayCount,0,null); | |||
| } | |||
| }else if(EnumBusRatioTime.MONTH.getCode().equals(wxRentContract.getBusDiscountTime())){ | |||
| if(startInt == endInt && months == 1){ | |||
| //刚好1个月 | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0); | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), | |||
| wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.OTHER.getCode(),dayCount,0,null); | |||
| }else{ | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0); | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(), | |||
| wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.MONTH.getCode(),dayCount,0,null); | |||
| } | |||
| }else if(EnumBusRatioTime.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(),EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod()); | |||
| ratioVo = WxRentContractServiceImpl.getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.BILL.getCode(),wxBillRent.getRevenue(),wxRentContract.getBusDiscountRatio(), | |||
| EnumMissTimeType.PERIOD.getCode(),dayCount,wxRentContract.getReceivePeriod(),wxRentContract.getReceivePeriodUnit()); | |||
| } | |||
| } | |||
| } | |||
| @@ -277,7 +277,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| bill.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| //bill.setShopId(record.getShopId()); | |||
| bill.setExpiredDay(0L); | |||
| setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| //setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| if (bill.getReceivePay().equals("0")) { | |||
| bill.setStatus(EnumBillStatus.PAID.getCode()); | |||
| bill.setPayDate(date); | |||
| @@ -629,7 +629,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| } | |||
| yearList.add(startDate); | |||
| } | |||
| Map<String, Object> resultMap = buildRent(receivePeriod, priceArr, yearList, Calendar.MONTH, wxPropertyContract, userId, wxMerchant, billcount, isPreview, shopInfo,saveDb); | |||
| Map<String, Object> resultMap = buildRent(receivePeriod, priceArr, yearList, wxPropertyContract.getReceivePeriodUnit(), wxPropertyContract, userId, wxMerchant, billcount, isPreview, shopInfo,saveDb); | |||
| List<WxBillProperty> billRentList = (List<WxBillProperty>)resultMap.get("billList"); | |||
| resultList.addAll(billRentList); | |||
| return resultList; | |||
| @@ -725,7 +725,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //截止收租日在当前时间之前 | |||
| Date date = new Date(); | |||
| setExpiredDay(wxBillProperty,dayType,receivePeriod); | |||
| //setExpiredDay(wxBillProperty,dayType,receivePeriod); | |||
| wxBillProperty.updateTenantInfo(wxPropertyContract); | |||
| wxBillProperty.setIsDel(0); | |||
| wxBillProperty.setMerchantId(wxPropertyContract.getMerchantId()); | |||
| @@ -826,27 +826,27 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| return needpay; | |||
| } | |||
| public void setExpiredDay(WxBillProperty wxBillProperty,int dayType, int receivePeriod){ | |||
| Date date = new Date(); | |||
| wxBillProperty.setExpiredDay(0L); | |||
| if (wxBillProperty.getReceiveDate().before(date)) { | |||
| long day = (date.getTime() - wxBillProperty.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| wxBillProperty.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| if (day > 0) { | |||
| wxBillProperty.setExpiredDay(day); | |||
| } | |||
| } else {//截止收租日在当前时间之后 | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(dayType, receivePeriod); | |||
| Date currenttime = now.getTime(); | |||
| //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| if (currenttime.before(wxBillProperty.getReceiveDate())) { | |||
| wxBillProperty.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| } else { | |||
| wxBillProperty.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| } | |||
| } | |||
| } | |||
| // public void setExpiredDay(WxBillProperty wxBillProperty,int dayType, int receivePeriod){ | |||
| // Date date = new Date(); | |||
| // wxBillProperty.setExpiredDay(0L); | |||
| // if (wxBillProperty.getReceiveDate().before(date)) { | |||
| // long day = (date.getTime() - wxBillProperty.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| // wxBillProperty.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| // if (day > 0) { | |||
| // wxBillProperty.setExpiredDay(day); | |||
| // } | |||
| // } else {//截止收租日在当前时间之后 | |||
| // Calendar now = Calendar.getInstance(); | |||
| // now.add(dayType, receivePeriod); | |||
| // Date currenttime = now.getTime(); | |||
| // //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| // if (currenttime.before(wxBillProperty.getReceiveDate())) { | |||
| // wxBillProperty.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| // } else { | |||
| // wxBillProperty.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| // } | |||
| // } | |||
| // } | |||
| public boolean isFirstDay(Date date){ | |||
| int dateInt = Integer.parseInt(new SimpleDateFormat("d").format(date)); | |||
| @@ -322,7 +322,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| * 获取设置的跳点率 | |||
| * ["1000-1200:10",">3000:20"] | |||
| */ | |||
| public static RatioVo getPayRatio(Integer decimalSize,int from,String revenueLong,String busDiscountRatio,int timeType,long dayCount,int period){ | |||
| public static RatioVo getPayRatio(Integer decimalSize,int from,String revenueLong,String busDiscountRatio,int timeType,long dayCount,int period,Integer periodUnit){ | |||
| RatioVo ratioVo = new RatioVo(); | |||
| if(StringUtils.isBlank(busDiscountRatio)){ | |||
| return ratioVo; | |||
| @@ -456,7 +456,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setPrice(countPrice(Constant.default_long_decimal_size,record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),EnumGetRatioFrom.RENT.getCode()).toPlainString()); | |||
| }else{ | |||
| int dayCount = record.getReceivePeriod() * 30; | |||
| RatioVo ratioVo = getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | |||
| RatioVo ratioVo = getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(), | |||
| record.getBusDiscountTime(),dayCount,record.getReceivePeriod(),record.getReceivePeriodUnit()); | |||
| //record.setPayRatio(ratioVo.getRatio()); | |||
| record.setPrice(ratioVo.getPrice()); | |||
| } | |||
| @@ -697,7 +698,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (null != shopIds && shopIds.size() == 1) { | |||
| bill.setShopId(shopIds.get(0)); | |||
| } | |||
| setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| //setExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| if (bill.getReceivePay().equals("0")) { | |||
| bill.setStatus(EnumBillStatus.PAID.getCode()); | |||
| bill.setPayDate(date); | |||
| @@ -767,7 +768,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (null != shopIds && shopIds.size() == 1) { | |||
| bill.setShopId(shopIds.get(0)); | |||
| } | |||
| setManageExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| //setManageExpiredDay(bill,Calendar.MONTH,record.getReceivePeriod()); | |||
| if (bill.getReceivePay().equals("0")) { | |||
| bill.setStatus(EnumBillStatus.PAID.getCode()); | |||
| bill.setPayDate(date); | |||
| @@ -808,7 +809,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setPrice(countPrice(Constant.default_long_decimal_size,record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),from).toPlainString()); | |||
| }else{ | |||
| int dayCount = record.getReceivePeriod() * 30; | |||
| RatioVo ratioVo = getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.RENT.getCode(),record.getRevenue(),record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod()); | |||
| RatioVo ratioVo = getPayRatio(Constant.default_long_decimal_size,EnumGetRatioFrom.RENT.getCode(),record.getRevenue(), | |||
| record.getBusDiscountRatio(),record.getBusDiscountTime(),dayCount,record.getReceivePeriod(),record.getReceivePeriodUnit()); | |||
| //record.setPayRatio(ratioVo.getRatio()); | |||
| record.setPrice(ratioVo.getPrice()); | |||
| } | |||
| @@ -1208,7 +1210,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| String shopInfoStr = getShopInfoStr(wxRentContract); | |||
| Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, Calendar.MONTH, wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb); | |||
| Map<String, Object> resultMap = buildRent(receivePeriod, priceArrs,bussinessManagerPriceArrs,operationManagerPriceArrs, yearList, wxRentContract.getReceivePeriodUnit(), wxRentContract, userId, billcount, isPreview, shopInfoStr,saveDb); | |||
| List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList"); | |||
| resultList.addAll(billRentList); | |||
| return resultList; | |||
| @@ -1620,7 +1622,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setOperatingManageFeeNeedPay(operatingManageFeeNeedpay); | |||
| //截止收租日在当前时间之前 | |||
| Date date = new Date(); | |||
| setExpiredDay(wxBillRent,dayType,receivePeriod); | |||
| //setExpiredDay(wxBillRent,dayType,receivePeriod); | |||
| wxBillRent.setRevenue("0"); | |||
| wxBillRent.updateTenantInfo(wxRentContract); | |||
| wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | |||
| @@ -1678,7 +1680,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| manage.setNeedPay(needPay); | |||
| manage.setReceivePay(needPay); | |||
| //manage.setOwe(needPay); | |||
| setManageExpiredDay(manage,dayType,receivePeriod); | |||
| //setManageExpiredDay(manage,dayType,receivePeriod); | |||
| //计算手续费 | |||
| BigDecimal servicePay = new BigDecimal(needPay).multiply(new BigDecimal(serviceChargeRate)).divide(new BigDecimal(10000), decimalSize, BigDecimal.ROUND_HALF_UP); | |||
| manage.setServiceChargePay(servicePay.toPlainString()); | |||
| @@ -1687,51 +1689,51 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return manage; | |||
| } | |||
| public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){ | |||
| //截止收租日在当前时间之前 | |||
| Date date = new Date(); | |||
| wxBillRent.setExpiredDay(0L); | |||
| if (wxBillRent.getReceiveDate().before(date)) { | |||
| long day = (date.getTime() - wxBillRent.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| wxBillRent.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| if (day > 0) { | |||
| wxBillRent.setExpiredDay(day); | |||
| } | |||
| } else {//截止收租日在当前时间之后 | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(dayType, receivePeriod); | |||
| Date currenttime = now.getTime(); | |||
| //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| if (currenttime.before(wxBillRent.getReceiveDate())) { | |||
| wxBillRent.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| } else { | |||
| wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| } | |||
| } | |||
| } | |||
| // public void setExpiredDay(WxBillRent wxBillRent,int dayType, int receivePeriod){ | |||
| // //截止收租日在当前时间之前 | |||
| // Date date = new Date(); | |||
| // wxBillRent.setExpiredDay(0L); | |||
| // if (wxBillRent.getReceiveDate().before(date)) { | |||
| // long day = (date.getTime() - wxBillRent.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| // wxBillRent.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| // if (day > 0) { | |||
| // wxBillRent.setExpiredDay(day); | |||
| // } | |||
| // } else {//截止收租日在当前时间之后 | |||
| // Calendar now = Calendar.getInstance(); | |||
| // now.add(dayType, receivePeriod); | |||
| // Date currenttime = now.getTime(); | |||
| // //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| // if (currenttime.before(wxBillRent.getReceiveDate())) { | |||
| // wxBillRent.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| // } else { | |||
| // wxBillRent.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| // } | |||
| // } | |||
| // } | |||
| public void setManageExpiredDay(WxBillRentManage wxBillRentManage,int dayType, int receivePeriod){ | |||
| //截止收租日在当前时间之前 | |||
| Date date = new Date(); | |||
| wxBillRentManage.setExpiredDay(0L); | |||
| if (wxBillRentManage.getReceiveDate().before(date)) { | |||
| long day = (date.getTime() - wxBillRentManage.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| wxBillRentManage.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| if (day > 0) { | |||
| wxBillRentManage.setExpiredDay(day); | |||
| } | |||
| } else {//截止收租日在当前时间之后 | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(dayType, receivePeriod); | |||
| Date currenttime = now.getTime(); | |||
| //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| if (currenttime.before(wxBillRentManage.getReceiveDate())) { | |||
| wxBillRentManage.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| } else { | |||
| wxBillRentManage.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| } | |||
| } | |||
| } | |||
| // public void setManageExpiredDay(WxBillRentManage wxBillRentManage,int dayType, int receivePeriod){ | |||
| // //截止收租日在当前时间之前 | |||
| // Date date = new Date(); | |||
| // wxBillRentManage.setExpiredDay(0L); | |||
| // if (wxBillRentManage.getReceiveDate().before(date)) { | |||
| // long day = (date.getTime() - wxBillRentManage.getReceiveDate().getTime()) / (24 * 60 * 60 * 1000); | |||
| // wxBillRentManage.setStatus(EnumBillStatus.NOT_PAID.getCode()); | |||
| // if (day > 0) { | |||
| // wxBillRentManage.setExpiredDay(day); | |||
| // } | |||
| // } else {//截止收租日在当前时间之后 | |||
| // Calendar now = Calendar.getInstance(); | |||
| // now.add(dayType, receivePeriod); | |||
| // Date currenttime = now.getTime(); | |||
| // //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 | |||
| // if (currenttime.before(wxBillRentManage.getReceiveDate())) { | |||
| // wxBillRentManage.setStatus(EnumBillStatus.NOT_EXPIRED.getCode()); | |||
| // } else { | |||
| // wxBillRentManage.setStatus(EnumBillStatus.WAIT_PAY.getCode()); | |||
| // } | |||
| // } | |||
| // } | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| @@ -3008,14 +3010,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //结束时间 | |||
| instance.clear(); | |||
| instance.setTime(start); | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DATE, -1); | |||
| instance = EnumContractReceivePeriodUnit.getAfterCalendarDay(instance, receivePeriod, dayType); | |||
| //instance.add(dayType, receivePeriod); | |||
| //instance.add(Calendar.DATE, -1); | |||
| timeVo.setEndDate(instance.getTime()); | |||
| //自然月 | |||
| if(adjustPeriod.equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())){ | |||
| if(count == 0){ | |||
| if(receivePeriod == 1) { //周期1个月 头一个月到当月底 | |||
| timeVo.setEndDate(EnumContractReceivePeriodUnit.getAfterCalendarNarDay(timeVo.getStartDate(), receivePeriod, dayType)); | |||
| /** | |||
| if(receivePeriod == 1) { //周期1个月 头一个月到当月底 头一个月或者头一个季度 | |||
| timeVo.setEndDate(DateUtils.getLastDayForMonth(timeVo.getStartDate())); | |||
| }else{ | |||
| Date firstDay = DateUtils.getFirstDayForCurrMonth(start); | |||
| @@ -3025,7 +3030,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| instance.add(dayType, receivePeriod); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| timeVo.setEndDate(instance.getTime()); | |||
| } | |||
| }*/ | |||
| } | |||
| } | |||
| @@ -452,6 +452,11 @@ public class WxShopServiceImpl implements WxShopService { | |||
| WxRentContract rc = rentList.get(0); | |||
| map.put("price", rc.getPrice()); | |||
| map.put("receivePeriod", rc.getReceivePeriod()); | |||
| EnumContractReceivePeriodUnit pu = EnumContractReceivePeriodUnit.getEnum(rc.getReceivePeriodUnit()); | |||
| if (null != pu) { | |||
| map.put("receivePeriodUnit", pu.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1554,4 +1554,89 @@ public class DateUtils { | |||
| c.add(Calendar.DAY_OF_MONTH, -1); | |||
| return c.getTime(); | |||
| } | |||
| //获取几个季度之后的季度开始时间 | |||
| public static Calendar getAfterQuaterStartDay(Date date,int quaters) { | |||
| Calendar start = Calendar.getInstance(); | |||
| start.setTime(date); | |||
| int currentYear = start.get(Calendar.YEAR); | |||
| //4个季度加一年 | |||
| int yearAdd = quaters/4; | |||
| int finalYear = currentYear + yearAdd; | |||
| //余下的月份 | |||
| int last = quaters % 4; | |||
| int currQuater = getQuater(start); | |||
| int finalQuater = currQuater + last; | |||
| if ( finalQuater > 4 ) { | |||
| finalYear = finalYear + 1; | |||
| finalQuater = finalQuater - 4; | |||
| } | |||
| return getQuaterStartDay(finalYear,finalQuater); | |||
| } | |||
| //获取时间的季度 | |||
| public static int getQuater(Calendar calendar) { | |||
| int month = calendar.get(Calendar.MONTH); | |||
| if (month >= 0 && month <=2 ) { | |||
| return 1; | |||
| }else if (month >= 3 && month <= 5) { | |||
| return 2; | |||
| }else if (month >= 6 && month <= 8) { | |||
| return 3; | |||
| }else { | |||
| return 4; | |||
| } | |||
| } | |||
| public static Calendar getQuaterStartDay(int year,int quater) { | |||
| Calendar start = Calendar.getInstance(); | |||
| start.set(Calendar.YEAR, year); | |||
| start.set(Calendar.DATE, 1); | |||
| start.set(Calendar.HOUR_OF_DAY, 0); | |||
| start.set(Calendar.MINUTE, 0); | |||
| start.set(Calendar.SECOND, 0); | |||
| switch(quater) { | |||
| case 1: | |||
| start.set(Calendar.MONTH, 0); | |||
| break; | |||
| case 2: | |||
| start.set(Calendar.MONTH, 3); | |||
| break; | |||
| case 3: | |||
| start.set(Calendar.MONTH, 6); | |||
| break; | |||
| case 4: | |||
| start.set(Calendar.MONTH, 9); | |||
| break; | |||
| } | |||
| return start; | |||
| } | |||
| public static Calendar getQuaterEndDay(int year,int quater) { | |||
| Calendar end = Calendar.getInstance(); | |||
| end.set(Calendar.YEAR, year); | |||
| end.set(Calendar.DATE, 1); | |||
| end.set(Calendar.HOUR_OF_DAY, 23); | |||
| end.set(Calendar.MINUTE, 59); | |||
| end.set(Calendar.SECOND, 59); | |||
| switch(quater) { | |||
| case 1: | |||
| end.set(Calendar.MONTH, 3); | |||
| break; | |||
| case 2: | |||
| end.set(Calendar.MONTH, 6); | |||
| break; | |||
| case 3: | |||
| end.set(Calendar.MONTH, 9); | |||
| break; | |||
| case 4: | |||
| end.set(Calendar.MONTH, 12); | |||
| break; | |||
| } | |||
| end.add(Calendar.DATE, -1); | |||
| return end; | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/> | |||
| <result column="receive_period_unit" jdbcType="INTEGER" property="receivePeriodUnit"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="filepath" jdbcType="VARCHAR" property="filepath"/> | |||
| @@ -59,7 +60,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`decimal_size`,`price`,`rental_start_date`,`rental_end_date`, | |||
| `sign_date`,`receive_period`,`tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`, | |||
| `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, | |||
| `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`,`receive_period_unit`, | |||
| `shop_type`,`updatetime`,`createtime`,`rent_area`,`rent_shop_type`, | |||
| `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`, | |||
| `start_date`,`end_date`,`apply_status`,`adjust_period`,`business_type`,adjust_ratio,`rent_info`,fixed_price, | |||
| @@ -76,6 +77,7 @@ | |||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and and out_date_notify_days is not null and out_date_notify_days > 0 </if> | |||
| <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | |||
| <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | |||
| <if test=" null != receivePeriodUnit ">and `receive_period_unit` = #{receivePeriodUnit}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -19,6 +19,7 @@ | |||
| <result column="rental_end_date" jdbcType="TIMESTAMP" property="rentalEndDate"/> | |||
| <result column="sign_date" jdbcType="TIMESTAMP" property="signDate"/> | |||
| <result column="receive_period" jdbcType="INTEGER" property="receivePeriod"/> | |||
| <result column="receive_period_unit" jdbcType="INTEGER" property="receivePeriodUnit"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="filepath" jdbcType="VARCHAR" property="filepath"/> | |||
| @@ -75,7 +76,6 @@ | |||
| <result column="fix_start_date" property="fixStartDate"/> | |||
| <result column="fix_end_date" property="fixEndDate"/> | |||
| <result column="business_type" property="businessType"/> | |||
| <result column="receive_period" property="receivePeriod"/> | |||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | |||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | |||
| <result column="price_unit" property="priceUnit"/> | |||
| @@ -98,7 +98,6 @@ | |||
| <result column="fix_start_date" property="fixStartDate"/> | |||
| <result column="fix_end_date" property="fixEndDate"/> | |||
| <result column="business_type" property="businessType"/> | |||
| <result column="receive_period" property="receivePeriod"/> | |||
| <result column="rent_info" jdbcType="VARCHAR" property="rentInfo"/> | |||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | |||
| <result column="price_unit" property="priceUnit"/> | |||
| @@ -133,7 +132,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`, | |||
| `shop_type_sub`,`lease_purpose`,`contractual_rules`,`delivery_date`,`delivery_grace_period`,`opening_date`,`business_hours`,`scope_metre`, | |||
| `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`, | |||
| `decimal_size`,`price`,`rental_start_date`,`rental_end_date`,`sign_date`,`receive_period`,`receive_period_unit`, | |||
| `tenant_id`,`parent_tenant_id`,`filepath`,`status`,`contract_number`, | |||
| `first_party_bank_info`,`second_party_bank_info`,`second_party_tax_info`, | |||
| `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`, | |||
| @@ -160,6 +159,7 @@ | |||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and out_date_notify_days is not null and out_date_notify_days > 0 </if> | |||
| <if test=" null != signDate and '' != signDate">and `sign_date` = #{signDate}</if> | |||
| <if test=" null != receivePeriod and '' != receivePeriod">and `receive_period` = #{receivePeriod}</if> | |||
| <if test=" null != receivePeriodUnit and '' != receivePeriodUnit">and `receive_period_unit` = #{receivePeriodUnit}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -468,7 +468,7 @@ | |||
| select | |||
| rc.`id`,rc.`merchant_id`, | |||
| rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`, | |||
| rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, | |||
| rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, rc.`receive_period_unit`, | |||
| rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`, | |||
| rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`, | |||
| rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, | |||
| @@ -495,7 +495,7 @@ | |||
| select | |||
| rc.`id`,rc.`merchant_id`, | |||
| rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`, | |||
| rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, | |||
| rc.`price`,rc.rent_area,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, rc.`receive_period_unit`, | |||
| rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`, | |||
| rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`, | |||
| rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, | |||