| @@ -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<String, Object> buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxPropertyContract wxPropertyContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map<String, Object> shopInfo, boolean isLastYesr) { | |||
| Map<String,Object> resultMap = new HashedMap(); | |||
| List<WxBillProperty> 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 ++; | |||
| } | |||
| @@ -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<String, Object> buildRent(int lease, int receivePeriod, long price, Date startdate, int dayType, WxRentContract wxRentContract, Long userId, WxMerchant wxMerchant, int billcount, Integer isPreview, Map<String, Object> 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 ++; | |||
| } | |||
| @@ -167,7 +167,7 @@ | |||
| <if test=" null != receivePay ">,receive_pay = #{receivePay},owe=#{receivePay}</if> | |||
| <if test=" null != comments ">,comments = #{comments}</if> | |||
| <if test=" null != receiveDate ">,receive_date = #{receiveDate}</if> | |||
| <if test="0 == receivePay">,status = 3,pay_date=now()</if> | |||
| <if test="0 == receivePay or 0l == receivePay">,status = 3,pay_date=now()</if> | |||
| where id = #{id} | |||
| </update> | |||
| @@ -167,7 +167,7 @@ | |||
| <if test=" null != receivePay ">,receive_pay = #{receivePay}</if> | |||
| <if test=" null != comments ">,comments = #{comments}</if> | |||
| <if test=" null != receiveDate ">,receive_date = #{receiveDate}</if> | |||
| <if test="0 == receivePay">,status = 3,pay_date=now()</if> | |||
| <if test="0 == receivePay or 0l == receivePay">,status = 3,pay_date=now()</if> | |||
| where id = #{id} | |||
| </update> | |||