diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java index b8bb0475a..c658ebba4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBusinessServiceImpl.java @@ -3,7 +3,9 @@ package com.iformall.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; -import com.iformall.domain.po.*; +import com.iformall.domain.po.WxBusiness; +import com.iformall.domain.po.WxPropertyContract; +import com.iformall.domain.po.WxRentContract; import com.iformall.enums.*; import com.iformall.mapper.WxBusinessMapper; import com.iformall.mapper.WxPropertyContractMapper; @@ -13,7 +15,6 @@ import com.iformall.service.WxPropertyContractService; import com.iformall.service.WxRentContractService; import com.iformall.utils.DateUtils; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -69,23 +70,22 @@ public class WxBusinessServiceImpl implements WxBusinessService { } @Override - public List> businessDataList(WxBusiness wxBusiness, Long userid) { + public List> businessDataList(WxBusiness wxBusiness, Long userid) { //1 得到天数+1 int day = DateUtils.daysBetween(wxBusiness.getStartdate(), wxBusiness.getEnddate()) + 1; - List> resultList = wxBusinessMapper.businessDataList(wxBusiness); - resultList.stream().forEach(e->{ + List> resultList = wxBusinessMapper.businessDataList(wxBusiness); + resultList.stream().forEach(e -> { BigDecimal businessSumMoney = new BigDecimal(0); WxRentContract query = new WxRentContract(); query.setBusinessId((Integer) e.get("id")); List rentContractList = wxRentContractMapper.select(query); - for (WxRentContract dbRent:rentContractList ) { - if (StringUtils.isBlank(dbRent.getRentInfo()) || - dbRent.getStatus().equals(EnumRentContractStatus.INTENTION.getCode()) || + for (WxRentContract dbRent : rentContractList) { + if (dbRent.getStatus().equals(EnumRentContractStatus.INTENTION.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.WAIT_SIGN.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_END.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) { - System.out.println("rent rentInfo is null:{}"+dbRent.getId()); + System.out.println("rent rentInfo is null:{}" + dbRent.getId()); continue; } Long price = dbRent.getPrice(); @@ -100,14 +100,13 @@ public class WxBusinessServiceImpl implements WxBusinessService { WxPropertyContract pquery = new WxPropertyContract(); pquery.setBusinessId((Integer) e.get("id")); List propertyContractList = wxPropertyContractMapper.select(pquery); - for (WxPropertyContract dbRent:propertyContractList) { - if (StringUtils.isBlank(dbRent.getRentInfo()) || - dbRent.getStatus().equals(EnumRentContractStatus.INTENTION.getCode()) || + for (WxPropertyContract dbRent : propertyContractList) { + if (dbRent.getStatus().equals(EnumRentContractStatus.INTENTION.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.WAIT_SIGN.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_END.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) || dbRent.getStatus().equals(EnumRentContractStatus.INVALID.getCode())) { - System.out.println("property rentInfo is null:{}"+dbRent.getId()); + System.out.println("property rentInfo is null:{}" + dbRent.getId()); continue; } logger.info("业态分析>>>>>>>>>>>>>>>>>>物业合同ID:" + dbRent.getId()); @@ -119,8 +118,8 @@ public class WxBusinessServiceImpl implements WxBusinessService { logger.info("业态分析>>>>>>>>>>>>>>>>>>商铺面积:" + e.get("area").toString()); if (e.get("area") == null || "0".equals(e.get("area").toString()) || "0.0".equals(e.get("area").toString())) { - e.put("rent",0); - }else { + e.put("rent", 0); + } else { BigDecimal area = new BigDecimal(e.get("area").toString()); if (area.doubleValue() > 0) { BigDecimal areaRatio = businessSumMoney.divide(area, 2, BigDecimal.ROUND_HALF_UP).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); @@ -162,9 +161,9 @@ public class WxBusinessServiceImpl implements WxBusinessService { wxBusiness.setLimitStart(0); wxBusiness.setLimitEnd(Integer.MAX_VALUE); List totalList = wxBusinessMapper.devoteList(wxBusiness); - if(CollectionUtils.isEmpty(totalList)){ + if (CollectionUtils.isEmpty(totalList)) { PageHelper.startPage(pageNum, pageSize); - PageInfo>> pageInfo = new PageInfo(new ArrayList()); + PageInfo>> pageInfo = new PageInfo(new ArrayList()); pageInfo.setPages(0); pageInfo.setTotal(0); PageHelper.clearPage(); @@ -173,17 +172,17 @@ public class WxBusinessServiceImpl implements WxBusinessService { int total = totalList.size(); int pages; - if(total % pageSize == 0){ + if (total % pageSize == 0) { pages = total / pageSize; - }else{ - pages = total / pageSize +1; + } else { + pages = total / pageSize + 1; } - wxBusiness.setLimitStart((pageNum -1) * pageSize); + wxBusiness.setLimitStart((pageNum - 1) * pageSize); wxBusiness.setLimitEnd(pageSize); - List> list = wxBusinessMapper.devoteList(wxBusiness); + List> list = wxBusinessMapper.devoteList(wxBusiness); PageHelper.startPage(pageNum, pageSize); - PageInfo>> pageInfo = new PageInfo(list); + PageInfo>> pageInfo = new PageInfo(list); pageInfo.setPages(pages); pageInfo.setTotal(total); PageHelper.clearPage();