Browse Source

【功能优化】居民年龄统计和总人数不一致

1.将居民生日字段为空或者空字符的记录统计在内
national_dev
Bill 2 years ago
parent
commit
036595c6d7
  1. 6
      code/smart-community/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  2. 16
      code/smart-community/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

6
code/smart-community/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -3980,6 +3980,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
orgIdPath=CustomerOrgRedis.getOrgIdPath(orgId,orgType);
}
List<ResiPortrayalResultDTO> resultList=getDefaultAgeDistribute();
ResiPortrayalResultDTO otherResult = new ResiPortrayalResultDTO();
otherResult.setCode(null);
otherResult.setTotalResi(0);
otherResult.setCodeName("未知");
resultList.add(otherResult);
List<ResiPortrayalResultDTO> list=baseDao.selectAgeAgeDistribute(customerId,orgId,orgType,orgIdPath);
if(CollectionUtils.isEmpty(list)){
result.setTotal(NumConstant.ZERO);

16
code/smart-community/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -1611,9 +1611,9 @@
<!-- 烟台居民画像:按照学历分组,查询居民数量-->
<select id="queryEducationDistribute" parameterType="map" resultType="com.epmet.dto.result.resi.ResiPortrayalResultDTO">
SELECT
r.CULTURE AS `code`,
count( r.id ) AS totalResi
FROM
CULTURE AS `code`,
count( id ) AS totalResi
FROM (SELECT ID, IF(CULTURE = '', NULL, CULTURE) AS CULTURE FROM
ic_resi_user r
WHERE
r.DEL_FLAG = '0'
@ -1627,8 +1627,9 @@
AND r.`STATUS` = '0'
-- AND r.CULTURE IS NOT NULL
-- AND r.CULTURE != ''
) iru
GROUP BY
r.CULTURE
iru.CULTURE
</select>
<!-- 烟台居民画像:年龄分布 -->
@ -1645,20 +1646,21 @@
when temp1.age &gt;= 60 and temp1.age &lt;= 69 then '2'
when temp1.age &gt;= 70 and temp1.age &lt;= 79 then '3'
when temp1.age &gt;= 80 then '4'
-- when temp1.age is NULL then '5'
end
) as `code`
from (
SELECT
u.ID,
YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) as age
IF((u.BIRTHDAY IS NULL OR u.BIRTHDAY =''),NULL,YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4)) as age
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
and u.`STATUS`='0'
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
-- and u.BIRTHDAY is not null
-- and u.BIRTHDAY !=''
<if test='orgType == "agency" '>
and u.PIDS LIKE concat(#{orgIdPath},'%')
</if>

Loading…
Cancel
Save