Browse Source

烟台居民列表

dev
yinzuomei 2 years ago
parent
commit
221b500a86
  1. 14
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java
  2. 51
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java
  3. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  4. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  5. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  6. 49
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  7. 77
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

14
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form.resi; package com.epmet.dto.form.resi;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data; import lombok.Data;
/** /**
@ -8,7 +9,7 @@ import lombok.Data;
* @Date 2023/4/11 17:03 * @Date 2023/4/11 17:03
*/ */
@Data @Data
public class ResiPortrayalCommonFormDTO { public class ResiPortrayalCommonFormDTO extends PageFormDTO {
/** /**
* /gov/org/customeragency/agencygridtree返回的agencyId * /gov/org/customeragency/agencygridtree返回的agencyId
*/ */
@ -17,5 +18,16 @@ public class ResiPortrayalCommonFormDTO {
* /gov/org/customeragency/agencygridtree返回level=grid时orgType:grid其他情况orgTypeagency * /gov/org/customeragency/agencygridtree返回level=grid时orgType:grid其他情况orgTypeagency
*/ */
private String orgType; private String orgType;
/**
* 查询居民列表
* 年龄饼图/学历饼图返回的code
*/
private String code;
/**
* 学历education
* 年龄age
*/
private String codeType;
} }

51
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java

@ -0,0 +1,51 @@
package com.epmet.dto.result.resi;
import lombok.Data;
/**
* @Description 烟台居民画像居民列表
* @Author yzm
* @Date 2023/4/12 10:10
*/
@Data
public class ResiPortrayalDetailDTO {
/**
* 居民id
*/
private String icResiUserId;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 性别1男2女0未知
*/
private String gender;
/**
* 性别名称
*/
private String genderName;
/**
* 身份证
*/
private String idCard;
/**
* 年龄
*/
private Integer age;
/**
* 学历key
*/
private String educationCode;
/**
* 学历
*/
private String educationName;
private String birthday;
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -63,6 +63,7 @@ import com.epmet.dto.form.resi.ResiPortrayalCommonFormDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO;
import com.epmet.dto.result.resi.ResiPortrayalDetailDTO;
import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.dto.result.resi.ResiPortrayalResultDTO;
import com.epmet.enums.IcResiUserTableEnum; import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.PartyMemberAgeExportExcel; import com.epmet.excel.PartyMemberAgeExportExcel;
@ -1555,5 +1556,22 @@ public class IcResiUserController implements ResultDataResolver {
return new Result<List<ResiPortrayalResultDTO>>().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); return new Result<List<ResiPortrayalResultDTO>>().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType()));
} }
/**
* 烟台需求https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98
* 居民画像居民列表
*
* @param tokenDto
* @param formDTO
* @return
*/
@MaskResponse(fieldNames = {"mobile", "idCard"},fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD})
@PostMapping("portrayal-list")
public Result<PageData<ResiPortrayalDetailDTO>> queryPortrayalResiList(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) {
return new Result<PageData<ResiPortrayalDetailDTO>>().ok(icResiUserService.queryPortrayalResiList(tokenDto.getCustomerId(), tokenDto.getUserId(),
formDTO.getPageNo(), formDTO.getPageSize(),
formDTO.getOrgId(), formDTO.getOrgType(),
formDTO.getCodeType(),
formDTO.getCode()));
}
} }

15
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -24,6 +24,7 @@ import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.IcVolunteerPolyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.resi.ResiPortrayalDetailDTO;
import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.dto.result.resi.ResiPortrayalResultDTO;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
@ -466,4 +467,18 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<ResiPortrayalResultDTO> selectAgeAgeDistribute(@Param("customerId") String customerId, List<ResiPortrayalResultDTO> selectAgeAgeDistribute(@Param("customerId") String customerId,
@Param("orgId") String orgId, @Param("orgId") String orgId,
@Param("orgType") String orgType); @Param("orgType") String orgType);
/**
* @param customerId
* @param orgId
* @param orgType
* @param codeType 学历education 年龄age
* @param code
* @return 居民画像居民列表
*/
List<ResiPortrayalDetailDTO> selectPortrayalResiList(@Param("customerId") String customerId,
@Param("orgId") String orgId,
@Param("orgType") String orgType,
@Param("codeType")String codeType,
@Param("code") String code);
} }

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -28,6 +28,7 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO;
import com.epmet.dto.result.resi.ResiPortrayalDetailDTO;
import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.dto.result.resi.ResiPortrayalResultDTO;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.excel.support.ExportResiUserItemDTO;
@ -554,7 +555,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param orgType * @param orgType
* @return * @return
*/ */
List<ResiPortrayalResultDTO> queryAgeDistribute(String customerId,String staffId,String orgId, String orgType); List<ResiPortrayalResultDTO> queryAgeDistribute(String customerId, String staffId, String orgId, String orgType);
/** /**
* 烟台需求https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 * 烟台需求https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98
@ -565,5 +566,16 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param orgType agency/grid * @param orgType agency/grid
* @return * @return
*/ */
List<ResiPortrayalResultDTO> queryEducationDistribute(String customerId,String staffId,String orgId, String orgType); List<ResiPortrayalResultDTO> queryEducationDistribute(String customerId, String staffId, String orgId, String orgType);
/**
* 烟台需求https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98
* 居民画像居民列表
*
* @return
*/
PageData<ResiPortrayalDetailDTO> queryPortrayalResiList(String customerId, String staffId,
Integer pageNo, Integer pageSize,
String orgId, String orgType,
String codeType,String code);
} }

49
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -62,6 +62,7 @@ import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO;
import com.epmet.dto.result.resi.ResiPortrayalDetailDTO;
import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.dto.result.resi.ResiPortrayalResultDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.enums.RenHuConditionEnum; import com.epmet.enums.RenHuConditionEnum;
@ -3932,14 +3933,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
switch (code) { switch (code) {
case 0: case 0:
resultDTO.setCodeName("50岁以下"); resultDTO.setCodeName("50岁以下");
break;
case 1: case 1:
resultDTO.setCodeName("50-59岁"); resultDTO.setCodeName("50-59岁");
break;
case 2: case 2:
resultDTO.setCodeName("60-69岁"); resultDTO.setCodeName("60-69岁");
break;
case 3: case 3:
resultDTO.setCodeName("70-79岁"); resultDTO.setCodeName("70-79岁");
break;
case 4: case 4:
resultDTO.setCodeName("80岁以上"); resultDTO.setCodeName("80岁以上");
break;
default: default:
resultDTO.setCodeName(StrConstant.EPMETY_STR); resultDTO.setCodeName(StrConstant.EPMETY_STR);
} }
@ -3989,5 +3995,48 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
/**
* 烟台需求https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98
* 居民画像居民列表
*
* @param customerId
* @param staffId
* @param pageNo
* @param pageSize
* @param orgId
* @param orgType
* @param codeType 学历education 年龄age
* @param code:年龄饼图/学历饼图返回的code
* @return
*/
@Override
public PageData<ResiPortrayalDetailDTO> queryPortrayalResiList(String customerId, String staffId,
Integer pageNo, Integer pageSize,
String orgId, String orgType,
String codeType,
String code) {
// 获取文化程度字典
DictListFormDTO dictFormDTO = new DictListFormDTO();
dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode());
Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败");
}
Map<String, String> educationMap = dictResult.getData().stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel));
if (StringUtils.isBlank(orgId)) {
orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId();
orgType = OrgTypeEnum.AGENCY.getCode();
}
PageHelper.startPage(pageNo, pageSize);
List<ResiPortrayalDetailDTO> list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,codeType, code);
list.forEach(resi -> {
// 学历名称
resi.setEducationName(educationMap.get(resi.getEducationCode()));
});
PageInfo<ResiPortrayalDetailDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(), pageSize);
}
} }

77
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -1546,13 +1546,13 @@
from ( from (
SELECT SELECT
u.ID, u.ID,
YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) as age, YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) as age,
( (
case when YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &lt; 50 then '0' case when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt; 50 then '0'
when YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &gt;=50 and YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &lt;=59 then '1' when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=59 then '1'
when YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &gt;=60 and YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &lt;=69 then '2' when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=69 then '2'
when YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &gt;=70 and YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &lt;=79 then '3' when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=79 then '3'
when YEAR(NOW())-SUBSTR(u.ID_CARD, 7, 4) &gt;=80 then '4' when YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=80 then '4'
end end
) as `code` ) as `code`
FROM FROM
@ -1560,8 +1560,9 @@
WHERE WHERE
u.DEL_FLAG = '0' u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId} AND u.CUSTOMER_ID = #{customerId}
AND u.ID_CARD IS NOT NULL
and u.`STATUS`='0' and u.`STATUS`='0'
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
<if test='orgType == "agency" '> <if test='orgType == "agency" '>
AND ( u.AGENCY_ID = #{orgId} OR u.PIDS LIKE concat('%',#{orgId},'%') ) AND ( u.AGENCY_ID = #{orgId} OR u.PIDS LIKE concat('%',#{orgId},'%') )
</if> </if>
@ -1571,4 +1572,66 @@
)temp )temp
group by temp.`code` group by temp.`code`
</select> </select>
<!-- 居民画像,居民列表 codeType 学历:education 年龄:age -->
<select id="selectPortrayalResiList" parameterType="map" resultType="com.epmet.dto.result.resi.ResiPortrayalDetailDTO">
SELECT
u.ID AS icResiUserId,
u.`NAME` AS `name`,
u.MOBILE AS mobile,
u.ID_CARD AS idCard,
u.GENDER AS gender,
( CASE WHEN u.GENDER = '1' THEN '男' WHEN u.GENDER = '2' THEN '女' ELSE '未知' END ) AS genderName,
YEAR (
NOW())- SUBSTR( u.BIRTHDAY, 1, 4 ) AS age,
u.CULTURE AS educationCode,
'' AS educationName,
IFNULL(u.CULTURE,'')AS educationCode,
u.BIRTHDAY AS birthday
FROM
ic_resi_user u
WHERE
u.DEL_FLAG = '0'
AND u.CUSTOMER_ID = #{customerId}
AND u.`STATUS` = '0'
<if test='orgType == "agency" '>
AND ( u.AGENCY_ID = #{orgId} OR u.PIDS LIKE concat('%',#{orgId},'%') )
</if>
<if test='orgType == "grid" '>
and u.GRID_ID = #{orgId}
</if>
<if test='codeType == "education" '>
<if test="code != null and code != ''">
and u.CULTURE = #{code}
</if>
</if>
<if test='codeType == "age" '>
<if test=" '0' == code">
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt; 50
</if>
<if test=" '1' == code">
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=50 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=59
</if>
<if test=" '2' == code">
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=60 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=69
</if>
<if test=" '3' == code">
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=70 and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &lt;=79
</if>
<if test=" '4' == code">
and u.BIRTHDAY is not null
and u.BIRTHDAY !=''
and YEAR(NOW())-SUBSTR(u.BIRTHDAY, 1, 4) &gt;=80
</if>
</if>
order by u.ID asc
</select>
</mapper> </mapper>

Loading…
Cancel
Save