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 1bd8539f8..657f3dc23 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -16,7 +16,6 @@ import com.iformall.mapper.*; import com.iformall.service.WxFlowRecordService; import com.iformall.service.WxFlowService; import com.iformall.service.WxPropertyContractService; -import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.lang3.StringUtils; @@ -33,7 +32,6 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.net.HttpURLConnection; import java.net.URL; -import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.*; 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 0041583b7..858918dde 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1799,6 +1799,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { public static double getMonthNeedPay(Double price,Date start,Date end){ SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); + SimpleDateFormat sdD = new SimpleDateFormat("d"); Double total = new Double(0); int[] diff; @@ -1816,6 +1817,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { return total; } + //判断是否满足整月 + int startInt = Integer.parseInt(sdD.format(start)); + int endInt = Integer.parseInt(sdD.format(end)); + if(startInt == (endInt+1)){ + int months = getMonths(sdM.format(start)+"-01",sdM.format(end)+"-01"); + return months * price; + } + //第一个月 Date lastMonthDay = DateUtils.getLastDayForMonth(start); diff = DateUtils.getDiff(start,lastMonthDay); @@ -1900,12 +1909,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { } public static void main(String[] args) throws Exception{ - long tprice = 100; +// long tprice = 100; SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); - Date start = sd.parse("2020-05-29"); - Date end = sd.parse("2020-07-28"); + Date start = sd.parse("2020-05-02"); +// Date end = sd.parse("2020-07-28"); // System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; + SimpleDateFormat sdD = new SimpleDateFormat("d"); + System.out.println(sdD.format(start)); } public static List initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){