|
@ -6,6 +6,7 @@ import com.alibaba.excel.ExcelReader; |
|
|
import com.alibaba.excel.read.metadata.ReadSheet; |
|
|
import com.alibaba.excel.read.metadata.ReadSheet; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
@ -13,6 +14,7 @@ import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
@ -50,8 +52,10 @@ import org.springframework.util.CollectionUtils; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.text.NumberFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Slf4j |
|
@ -348,7 +352,41 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public HouseChartResultDTO houseChart(HouseChartFormDTO formDTO) { |
|
|
public HouseChartResultDTO houseChart(HouseChartFormDTO formDTO) { |
|
|
return null; |
|
|
HouseChartResultDTO resultDTO = new HouseChartResultDTO(); |
|
|
|
|
|
//计算百分比使用,保留小数点后两位
|
|
|
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.TWO); |
|
|
|
|
|
//1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息
|
|
|
|
|
|
if (StringUtils.isEmpty(formDTO.getOrgId())) { |
|
|
|
|
|
//2.获取工作人员缓存信息
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
|
|
if (null == staffInfo) { |
|
|
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
|
|
} |
|
|
|
|
|
formDTO.setOrgId(staffInfo.getAgencyId()); |
|
|
|
|
|
formDTO.setOrgType("agency"); |
|
|
|
|
|
} |
|
|
|
|
|
//2.根据入参值查询对应的房屋统计数据
|
|
|
|
|
|
List<HouseChartResultDTO> list = icHouseDao.houseChart(formDTO.getOrgId(), formDTO.getOrgType()); |
|
|
|
|
|
//3.汇总数据
|
|
|
|
|
|
AtomicInteger houseTotal = new AtomicInteger(); |
|
|
|
|
|
list.forEach(l -> { |
|
|
|
|
|
houseTotal.addAndGet(l.getNum()); |
|
|
|
|
|
if (l.getRentFlag() == 0) { |
|
|
|
|
|
resultDTO.setZzHouseTotal(l.getNum()); |
|
|
|
|
|
} else if (l.getRentFlag() == 0) { |
|
|
|
|
|
resultDTO.setCzHouseTotal(l.getNum()); |
|
|
|
|
|
} else { |
|
|
|
|
|
resultDTO.setXzHouseTotal(l.getNum()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
resultDTO.setHouseTotal(houseTotal.get()); |
|
|
|
|
|
resultDTO.setZzHouseRatio((resultDTO.getHouseTotal() == 0 || resultDTO.getZzHouseTotal() > resultDTO.getHouseTotal()) ? "0%" : numberFormat.format(((float) resultDTO.getZzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100) + "%"); |
|
|
|
|
|
resultDTO.setCzHouseRatio((resultDTO.getHouseTotal() == 0 || resultDTO.getCzHouseTotal() > resultDTO.getHouseTotal()) ? "0%" : numberFormat.format(((float) resultDTO.getCzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100) + "%"); |
|
|
|
|
|
resultDTO.setXzHouseRatio((resultDTO.getHouseTotal() == 0 || resultDTO.getXzHouseTotal() > resultDTO.getHouseTotal()) ? "0%" : numberFormat.format(((float) resultDTO.getXzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100) + "%"); |
|
|
|
|
|
resultDTO.setOrgId(formDTO.getOrgId()); |
|
|
|
|
|
resultDTO.setOrgType(formDTO.getOrgType()); |
|
|
|
|
|
return resultDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|