| @@ -1,10 +1,8 @@ | |||
| package com.iformall.controller.contract; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.annotation.UserDataRuleAnnotation; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| @@ -87,68 +85,6 @@ public class WxRentContractController extends WxContractBaseController { | |||
| } | |||
| } | |||
| wrc.setFlowHas(hasFlow); | |||
| // String renInfo = wrc.getRentInfo(); | |||
| // if (!StringUtils.isBlank(renInfo)) { | |||
| // String floorName = ""; | |||
| // String buildingName = ""; | |||
| // String shopNumber = ""; | |||
| // JSONArray arrays = JSONArray.parseArray(renInfo); | |||
| // if ( null != arrays) { | |||
| //// List<Long> floorIds = new ArrayList<Long>(); | |||
| //// List<Long> buildIds = new ArrayList<Long>(); | |||
| //// List<Long> shopIds = new ArrayList<Long>(); | |||
| //// for (int i = 0 ; i < arrays.size(); i ++) { | |||
| //// JSONObject o = arrays.getJSONObject(i); | |||
| //// try { | |||
| //// floorIds.add(Long.parseLong(o.getString("floor"))); | |||
| //// }catch(Exception e) { | |||
| //// floorName = floorName +","+o.getString("floor"); | |||
| //// } | |||
| //// try { | |||
| //// buildIds.add(Long.parseLong(o.getString("building"))); | |||
| //// }catch(Exception e) { | |||
| //// buildingName = buildingName + ","+ o.getString("building"); | |||
| //// } | |||
| //// try { | |||
| //// shopIds.add(Long.parseLong(o.getString("id"))); | |||
| //// }catch(Exception e) { | |||
| //// shopNumber = shopNumber +","+o.getString("id"); | |||
| //// } | |||
| //// } | |||
| //// | |||
| //// WxMallBuilding bq = new WxMallBuilding(); | |||
| //// bq.setIds(buildIds); | |||
| //// PageInfo<WxMallBuilding> bpage = buildingService.listAsPage(bq, 1, 1000); | |||
| //// if (null != bpage && null != bpage.getList()) { | |||
| //// for (WxMallBuilding wmb : bpage.getList()) { | |||
| //// buildingName = buildingName +"," + wmb.getBuildingName(); | |||
| //// } | |||
| //// } | |||
| //// | |||
| //// WxMallFloor fq = new WxMallFloor(); | |||
| //// fq.setIds(floorIds); | |||
| //// PageInfo<WxMallFloor> fpage = floorService.listAsPage(fq, 1, 1000); | |||
| //// if (null != fpage && null != fpage.getList()) { | |||
| //// for (WxMallFloor wmf : fpage.getList()) { | |||
| //// floorName = floorName +"," + wmf.getFloorName(); | |||
| //// } | |||
| //// } | |||
| //// | |||
| //// WxShop ws = new WxShop(); | |||
| //// ws.setIds(shopIds); | |||
| //// PageInfo<WxShop> spage = wxShopService.listAsPage(ws, 1, 1000); | |||
| //// if (null != spage && null != spage.getList()) { | |||
| //// for (WxShop shop : spage.getList()) { | |||
| //// shopNumber = shopNumber+","+shop.getShopNumber(); | |||
| //// } | |||
| //// } | |||
| // | |||
| // wrc.setFloorName(floorName); | |||
| // wrc.setBuildingName(buildingName); | |||
| // wrc.setShopNumber(shopNumber); | |||
| // } | |||
| // | |||
| // } | |||
| } | |||
| } | |||
| @@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -567,5 +568,26 @@ public class WxRentContract extends TenantEntity { | |||
| private Long propertyContractId; | |||
| @TableField(exist = false) | |||
| private List<RentContractFreePeriodVo> freePeriods; | |||
| public void setFreeVo(List<WxRentContractFreePeriod> freePeriods) { | |||
| if (null != freePeriods) { | |||
| Map<Integer,RentContractFreePeriodVo> yearVoMap = new HashMap<Integer,RentContractFreePeriodVo>(); | |||
| List<RentContractFreePeriodVo> voList = new ArrayList<RentContractFreePeriodVo>(); | |||
| for (int i = 0 ; i < freePeriods.size() ; i ++) { | |||
| WxRentContractFreePeriod fp = freePeriods.get(i); | |||
| RentContractFreePeriodVo vo = yearVoMap.get(fp.getYearIndex()); | |||
| if (null == vo ) { | |||
| vo = new RentContractFreePeriodVo(); | |||
| yearVoMap.put(fp.getYearIndex(), vo); | |||
| voList.add(vo); | |||
| vo.setYearIndex(fp.getYearIndex()); | |||
| } | |||
| if (null == vo.getPeriods()) { | |||
| vo.setPeriods(new ArrayList<WxRentContractFreePeriod>()); | |||
| } | |||
| vo.getPeriods().add(fp); | |||
| } | |||
| this.setFreePeriods(voList); | |||
| } | |||
| } | |||
| } | |||
| @@ -284,6 +284,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContract.setPrice(StringUtils.isNotBlank(wxRentContract.getPrice()) ? wxRentContract.getPrice() : "0"); | |||
| wxRentContract.setDeposit(StringUtils.isNotBlank(wxRentContract.getDeposit()) ? wxRentContract.getDeposit() : "0"); | |||
| //免租期 | |||
| WxRentContractFreePeriod fpq = new WxRentContractFreePeriod(); | |||
| fpq.updateTenantInfo(wxRentContract); | |||
| fpq.setRentContractId(wxRentContract.getId()); | |||
| fpq.setSortColumn("year_index asc,start_date asc"); | |||
| List<WxRentContractFreePeriod> freePeroids = wxRentContractFreePeriodMapper.findList(fpq); | |||
| wxRentContract.setFreeVo(freePeroids); | |||
| result.put("wxRentContract", wxRentContract); | |||
| //关联的商户 | |||
| if (wxRentContract.getMerchantId() != null) { | |||
| @@ -1355,6 +1362,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| //免租期 | |||
| WxRentContractFreePeriod fpq = new WxRentContractFreePeriod(); | |||
| fpq.updateTenantInfo(wxRentContract); | |||
| fpq.setRentContractId(wxRentContract.getId()); | |||
| fpq.setSortColumn("start_date asc"); | |||
| List<WxRentContractFreePeriod> freePeroids = wxRentContractFreePeriodMapper.findList(fpq); | |||
| int index = 0; | |||
| for (int i = 0; i < billTimeVoList.size(); i++) { | |||
| BillTimeVo billTimeVo = billTimeVoList.get(i); | |||
| @@ -1971,10 +1985,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // } | |||
| public static List<BillTimeVo> initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){ | |||
| List<BillTimeVo> list = new ArrayList<>(); | |||
| int count = 0; | |||
| while (true){ | |||
| BillTimeVo timeVo = new BillTimeVo(); | |||
| @@ -2355,6 +2367,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| fpq.updateTenantInfo(wxRentContract); | |||
| fpq.setRentContractId(wxRentContract.getId()); | |||
| fpq.setYearIndex(i+1); | |||
| fpq.setSortColumn("start_date asc"); | |||
| vo.setPeriods(wxRentContractFreePeriodMapper.findList(fpq)); | |||
| volist.add(vo); | |||
| } | |||