Browse Source

Merge remote-tracking branch 'origin/dev_resi_export' into dev_resi_export

release
yinzuomei 3 years ago
parent
commit
5434d39a51
  1. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java
  2. 22
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java
  3. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  4. 40
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  5. 34
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java

@ -152,7 +152,9 @@ public class MaskProcessor {
return originString; return originString;
} }
return originString.replace(originString.substring(6), StrUtil.repeatByLength("*", length - 6)); String maskStr = StrUtil.repeatByLength("*", length - 6);
return originString.replaceAll("^(\\d{6})[a-zA-Z0-9]*$", new StringBuilder("$1").append(maskStr).toString());
} }
/** /**
@ -171,4 +173,11 @@ public class MaskProcessor {
return originString.replaceAll("^(1\\d{2})\\d*(\\d{4})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); return originString.replaceAll("^(1\\d{2})\\d*(\\d{4})$", new StringBuilder("$1").append(maskStr).append("$2").toString());
} }
public static void main(String[] args) {
String[] idc = {"idCard"};
String[] idct = {MaskResponse.MASK_TYPE_ID_CARD};
String r = new MaskProcessor(idc, idct).maskString("333333333333333333", MaskResponse.MASK_TYPE_ID_CARD);
System.out.println(r);
}
} }

22
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java

@ -1,5 +1,7 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -21,30 +23,36 @@ public class HouseChartResultDTO implements Serializable {
/** /**
* 房屋总数 * 房屋总数
*/ */
private Integer houseTotal; private Integer houseTotal = 0;
/** /**
* 房屋自住总数 * 房屋自住总数
*/ */
private Integer zzHouseTotal; private Integer zzHouseTotal = 0;
/** /**
* 房屋自住总数占比保留两位小数带百分号的 * 房屋自住总数占比保留两位小数带百分号的
*/ */
private String zzHouseRatio; private String zzHouseRatio = "0%";
/** /**
* 房屋常住总数 * 房屋常住总数
*/ */
private Integer czHouseTotal; private Integer czHouseTotal = 0;
/** /**
* 房屋常住总数占比保留两位小数带百分号的 * 房屋常住总数占比保留两位小数带百分号的
*/ */
private String czHouseRatio; private String czHouseRatio = "0%";
/** /**
* 房屋闲置总数 * 房屋闲置总数
*/ */
private Integer xzHouseTotal; private Integer xzHouseTotal = 0;
/** /**
* 房屋闲置总数占比保留两位小数带百分号的 * 房屋闲置总数占比保留两位小数带百分号的
*/ */
private String xzHouseRatio; private String xzHouseRatio = "0%";
@JsonIgnore
private Integer num;
//1:出租 0:自住 2:闲置
@JsonIgnore
private Integer rentFlag;
} }

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java

@ -3,10 +3,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.IcHouseListFormDTO; import com.epmet.dto.form.IcHouseListFormDTO;
import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.HousesNameResultDTO;
import com.epmet.dto.result.IcHouseListResultDTO;
import com.epmet.dto.result.NeighborHoodManageDelResultDTO;
import com.epmet.entity.IcHouseEntity; import com.epmet.entity.IcHouseEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -83,4 +80,9 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
*/ */
List<HousesNameResultDTO> getHousesNameByIdCards(@Param("idCards") List<String> idCards); List<HousesNameResultDTO> getHousesNameByIdCards(@Param("idCards") List<String> idCards);
/**
* @Author sun
* @Description 人房房屋总数饼图
**/
List<HouseChartResultDTO> houseChart(@Param("orgId") String orgId, @Param("orgType") String orgType);
} }

40
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -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;
} }
/** /**

34
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -289,4 +289,38 @@
) )
GROUP BY h.OWNER_ID_CARD GROUP BY h.OWNER_ID_CARD
</select> </select>
<select id="houseChart" resultType="com.epmet.dto.result.HouseChartResultDTO">
SELECT
COUNT(id) num, rent_flag rentFlag
FROM
ic_house
WHERE del_flag = '0'
<choose>
<when test='orgType == "agency"'>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and (agency_id = #{orgId} OR agency_pids LIKE CONCAT('%', #{orgId}, '%'))
)
</when>
<when test='orgType == "grid"'>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and grid_id = #{orgId}
)
</when>
<otherwise>
AND neighbor_hood_id IN (
select id from ic_neighbor_hood
where del_flag = '0'
and id = #{orgId}
)
</otherwise>
</choose>
GROUP BY rent_flag
</select>
</mapper> </mapper>

Loading…
Cancel
Save