diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index c5d12939f..dcf138f24 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -919,18 +919,31 @@ public class WxRentContractController extends WxContractBaseController { List yearList = wxRentContractService.getYearList(years, 12, rentContract.getRentalStartDate(),endcontract); if (null != yearList && yearList.size() > 0) { List retList = new ArrayList(); - Date begin = null; - for (int i = 0 ; i < yearList.size()-1 ; i ++) { - int yearindex = i+1; - begin = yearList.get(i); - Date end = yearList.get(i+1); - Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); + if (yearList.size() == 1) { WxRentContractYearsVo vo = new WxRentContractYearsVo(); - vo.setStart(begin); - vo.setEnd(realEnd); - vo.setRemark("第"+yearindex+"年度"); + vo.setStart(yearList.get(0)); + vo.setEnd(rentContract.getRentalEndDate()); + vo.setRemark("第1年度"); retList.add(vo); - begin = end; + }else { + Date begin = null; + for (int i = 0 ; i < yearList.size()-1 ; i ++) { + int yearindex = i+1; + begin = yearList.get(i); + Date end = yearList.get(i+1); + Date realEnd = DateUtils.getDaySet(end, Calendar.SECOND, -1); + WxRentContractYearsVo vo = new WxRentContractYearsVo(); + vo.setStart(begin); + vo.setEnd(realEnd); + vo.setRemark("第"+yearindex+"年度"); + retList.add(vo); + begin = end; + } + WxRentContractYearsVo vo = new WxRentContractYearsVo(); + vo.setStart(yearList.get(yearList.size()-1)); + vo.setEnd(rentContract.getRentalEndDate()); + vo.setRemark("第"+yearList.size()+"年度"); + retList.add(vo); } return new ResultData(retList); }