diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index eb18c482e..83dc5e25a 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -156,6 +156,9 @@ public class WxPropertyContract implements Serializable { @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") private Integer rentShopType; + @io.swagger.annotations.ApiModelProperty(value = "计租周期", name = "计租周期") + private Integer adjustPeriod; + public Integer getApplyStatus() { return applyStatus; } @@ -351,6 +354,14 @@ public class WxPropertyContract implements Serializable { this.rentShopType = rentShopType; } + public Integer getAdjustPeriod() { + return adjustPeriod; + } + + public void setAdjustPeriod(Integer adjustPeriod) { + this.adjustPeriod = adjustPeriod; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 8049587e8..5557d5cbb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -7,10 +7,7 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; -import com.iformall.enums.EnumBillRentStatus; -import com.iformall.enums.EnumDelStatus; -import com.iformall.enums.EnumRentContractStatus; -import com.iformall.enums.EnumShopStatus; +import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.WxPropertyContractService; @@ -251,6 +248,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService List list = wxPropertyContractMapper.findList(wxPropertyContract); if (list.size() > 0) { wxPropertyContract = list.get(0); + //找到计租方式 + int dayType = wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) ? Calendar.DAY_OF_MONTH : Calendar.MONTH; final IdWorker idWorker = IdWorker.get(); WxBillPropertyDeposit wxBillDeposit = new WxBillPropertyDeposit(); wxBillDeposit.setId(idWorker.nextId()); @@ -274,7 +273,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //账单结束时间 instance.clear(); instance.setTime(wxBillDeposit.getReceiveDate()); - instance.add(Calendar.MONTH, wxPropertyContract.getLease()); + instance.add(dayType, wxPropertyContract.getLease()); wxBillDeposit.setEndtime(instance.getTime()); //截止收租日在当前时间之前 if (wxBillDeposit.getReceiveDate().before(date)) { @@ -310,6 +309,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService List list = wxPropertyContractMapper.findList(wxPropertyContract); if (list.size() > 0) { wxPropertyContract = list.get(0); + int dayType = wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) ? Calendar.MONTH : Calendar.DAY_OF_MONTH; int receivePeriod = wxPropertyContract.getReceivePeriod().intValue(); Integer lease = wxPropertyContract.getLease(); int extralease = lease % receivePeriod; @@ -327,7 +327,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService Date date = new Date(); Calendar instance = Calendar.getInstance(); instance.setTime(wxPropertyContract.getRentalStartDate()); - instance.add(Calendar.MONTH, receivePeriod * i); + instance.add(dayType, receivePeriod * i); instance.add(Calendar.DAY_OF_MONTH, -1); Date time = instance.getTime(); wxBillProperty.setReceiveDate(time); @@ -340,7 +340,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //账单结束时间 instance.clear(); instance.setTime(wxBillProperty.getStarttime()); - instance.add(Calendar.MONTH, receivePeriod); + instance.add(dayType, receivePeriod); instance.add(Calendar.DAY_OF_MONTH, -1); wxBillProperty.setEndtime(instance.getTime()); int needpay = wxPropertyContract.getPrice() * receivePeriod; @@ -353,7 +353,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService //账单结束时间 instance.clear(); instance.setTime(wxBillProperty.getStarttime()); - instance.add(Calendar.MONTH, extralease); + instance.add(dayType, extralease); instance.add(Calendar.DAY_OF_MONTH, -1); wxBillProperty.setEndtime(instance.getTime()); needpay = wxPropertyContract.getPrice() * extralease; @@ -367,7 +367,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxBillProperty.setExpiredDay(day); } else {//截止收租日在当前时间之后 Calendar now = Calendar.getInstance(); - now.add(Calendar.MONTH, receivePeriod); + now.add(dayType, receivePeriod); Date currenttime = now.getTime(); //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 if (currenttime.before(wxBillProperty.getReceiveDate())) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 71e8f3b73..26a4fa32c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -465,7 +465,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxBillRent.setExpiredDay(day); } else {//截止收租日在当前时间之后 Calendar now = Calendar.getInstance(); - now.add(Calendar.MONTH, receivePeriod); + now.add(dayType, receivePeriod); Date currenttime = now.getTime(); //当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 if (currenttime.before(wxBillRent.getReceiveDate())) { diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml index 35de11c19..35352513e 100644 --- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml @@ -33,7 +33,9 @@ - + + + @@ -42,7 +44,7 @@ `deposit`,`pay_date`,`is_del`,`merchant_name`,`brand`,`business_id`, `shop_type`,`shop_id`,`updatetime`,`createtime`,`rent_area`, `link_person`,`link_phone`,`pay_account`,`filename`,`lease`,`rent_contract_id`, - `start_date`,`end_date`,`apply_status` + `start_date`,`end_date`,`apply_status`,`adjust_period` @@ -101,7 +103,7 @@ f.floor_name floorName,b.building_name buildingName,receive_period receivePeriod, rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate, start_date startDate,end_date endDate,rc.rent_contract_id rentContractId,br.`name` brandName, - s.addr,rc.apply_status applyStatus + s.addr,rc.apply_status applyStatus,rc.adjust_period adjustPeriod from wx_property_contract rc left join wx_shop s on rc.shop_id=s.id left join wx_mall_floor f on s.floor=f.id