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 4c8696422..9c8b870a6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -113,7 +113,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService Double rentPrice = rentInfoObject.getDouble("rentPrice"); Long price = wxPropertyContract.getPrice()/100; if(rentPrice == null){ - if(wxPropertyContract.getRentArea() != null) { + if(StringUtils.isNotBlank(wxPropertyContract.getRentArea())) { Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); rentInfoObject.put("rentPrice", rentPrice); @@ -123,7 +123,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxPropertyContract.setRentInfo(rentInfoArray.toJSONString()); }else{ if(wxPropertyContract.getRentPrice() == null || "0".equals(wxPropertyContract.getRentPrice())){ - if(wxPropertyContract.getRentArea()!=null) { + if(StringUtils.isNotBlank(wxPropertyContract.getRentArea())) { Long price = wxPropertyContract.getPrice() / 100; Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); Double rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -541,6 +541,16 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService return false; } + public boolean isCrossMonth(Date start,Date end){ + int startInt = Integer.parseInt(new SimpleDateFormat("M").format(start)); + int endInt = Integer.parseInt(new SimpleDateFormat("M").format(end)); + + if(startInt != endInt){ + return true; + } + return false; + } + public Map buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxPropertyContract wxPropertyContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map shopInfo, boolean isLastYesr) { Map resultMap = new HashedMap(); List resultList = new ArrayList<>(); @@ -554,7 +564,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService && !isFirstDay(wxPropertyContract.getRentalStartDate()) && (wxPropertyContract.getLease() % wxPropertyContract.getReceivePeriod() == 0) && isLastYesr - && wxPropertyContract.getReceivePeriod() != 1 + && isCrossMonth(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate()) ){ paycount ++; } 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 1d5ab027b..85cdfeb25 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -136,7 +136,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { Double rentPrice = rentInfoObject.getDouble("rentPrice"); Long price = wxRentContract.getPrice()/100; if(rentPrice == null){ - if(wxRentContract.getRentArea() != null) { + if(StringUtils.isNotBlank(wxRentContract.getRentArea())) { Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); rentInfoObject.put("rentPrice", rentPrice); @@ -146,7 +146,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxRentContract.setRentInfo(rentInfoArray.toJSONString()); }else{ if(wxRentContract.getRentPrice() == null || "0".equals(wxRentContract.getRentPrice())){ - if(wxRentContract.getRentArea() != null){ + if(StringUtils.isNotBlank(wxRentContract.getRentArea())) { Long price = wxRentContract.getPrice()/100; Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -864,6 +864,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { return false; } + public boolean isCrossMonth(Date start,Date end){ + int startInt = Integer.parseInt(new SimpleDateFormat("M").format(start)); + int endInt = Integer.parseInt(new SimpleDateFormat("M").format(end)); + + if(startInt != endInt){ + return true; + } + return false; + } + public Map buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map shopInfo, boolean isLastYesr) { System.out.println("------lease:"+lease+"receivePeriod:"+receivePeriod+"price:"+price+"start:"+DateUtils.date2String(startdate,"yyyy-MM-dd") +"dayType:"+dayType+"billcount:"+billcount); @@ -899,7 +909,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { && !isFirstDay(wxRentContract.getRentalStartDate()) && (wxRentContract.getLease() % wxRentContract.getReceivePeriod() == 0) && isLastYesr - && wxRentContract.getReceivePeriod() != 1 + && isCrossMonth(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()) ){ paycount ++; } diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index f4c5cde28..3c77121ef 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -167,7 +167,7 @@ ,receive_pay = #{receivePay},owe=#{receivePay} ,comments = #{comments} ,receive_date = #{receiveDate} - ,status = 3,pay_date=now() + ,status = 3,pay_date=now() where id = #{id} diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index da4272f5c..31c889857 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -167,7 +167,7 @@ ,receive_pay = #{receivePay} ,comments = #{comments} ,receive_date = #{receiveDate} - ,status = 3,pay_date=now() + ,status = 3,pay_date=now() where id = #{id}