Browse Source

rhzk

master
zxc 3 years ago
parent
commit
246fa40527
  1. 37
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RHZKStatisticsResultDTO.java
  2. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  3. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  5. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  6. 57
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  7. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

37
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RHZKStatisticsResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2022/11/16 09:15
*/
@Data
public class RHZKStatisticsResultDTO implements Serializable {
private static final long serialVersionUID = 6493812449146476415L;
private Integer userTotal = NumConstant.ZERO;
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
private Integer rhyzUserTotal = NumConstant.ZERO;
private BigDecimal rhyzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer rzhbzUserTotal = NumConstant.ZERO;
private BigDecimal rzhbzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer hzrzUserTotal = NumConstant.ZERO;
private BigDecimal hzrzUserRatio = NumConstant.ZERO_DECIMAL;
private Integer zbqcUserTotal = NumConstant.ZERO;
private BigDecimal zbqcUserRatio = NumConstant.ZERO_DECIMAL;
@JsonIgnore
private Integer total;
@JsonIgnore
private String rhzk;
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java

@ -108,4 +108,13 @@ public interface UserConstant {
* 居民信息 子表中的主表id
*/
String IC_RESI_USER = "IC_RESI_USER";
/**
* 人户一致人在户不在户在人不在
* 为空的 暂不清楚
*/
String R_H_Y_Z = "rhyz";
String R_Z_H_B_Z = "rzhbz";
String H_Z_R_B_Z = "hzrbz";
String Z_B_Q_C = "";
}

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

@ -1465,4 +1465,15 @@ public class IcResiUserController implements ResultDataResolver {
return new Result<IcResiUserInfoCache>().ok(icResiUserService.getIcResiUserInfo(userId));
}
/**
* @Description 人户状况统计查询
* @param tokenDto
* @Author zxc
* @Date 2022/11/16 09:22
*/
@PostMapping("rhzk")
public Result<RHZKStatisticsResultDTO> renHuCondition(@LoginUser TokenDto tokenDto){
return new Result<RHZKStatisticsResultDTO>().ok(icResiUserService.renHuCondition(tokenDto));
}
}

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

@ -439,4 +439,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
* @Date 2022/10/24 15:47
*/
ResiAndLocalResiResultDTO getResiCount(@Param("agencyId")String agencyId,@Param("idCard")String idCard,@Param("customerId")String customerId);
List<RHZKStatisticsResultDTO> getUserByRenHu(@Param("agencyId")String agencyId);
}

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

@ -525,4 +525,13 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
IcResiUserInfoCache getIcResiUserInfo(String userId);
void epidemicPreventionExport(EpidemicPreventionFormDTO formDTO, HttpServletResponse response) throws IOException;
/**
* @Description 人户状况统计查询
* @param tokenDto
* @Author zxc
* @Date 2022/11/16 09:22
*/
RHZKStatisticsResultDTO renHuCondition(TokenDto tokenDto);
}

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

@ -3630,4 +3630,61 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
}
/**
* @Description 人户状况统计查询
* @param tokenDto
* @Author zxc
* @Date 2022/11/16 09:22
*/
@Override
public RHZKStatisticsResultDTO renHuCondition(TokenDto tokenDto) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员:"+tokenDto.getUserId());
}
List<RHZKStatisticsResultDTO> userByRenHu = baseDao.getUserByRenHu(staffInfo.getAgencyId());
RHZKStatisticsResultDTO r = new RHZKStatisticsResultDTO();
if (CollectionUtils.isEmpty(userByRenHu)){
return r;
}
r.setUserTotal(userByRenHu.stream().collect(Collectors.summingInt(RHZKStatisticsResultDTO::getTotal)));
userByRenHu.forEach(u -> {
switch (u.getRhzk()){
case UserConstant.R_H_Y_Z:
r.setRhyzUserTotal(u.getTotal());
r.setRhyzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.R_Z_H_B_Z:
r.setRzhbzUserTotal(u.getTotal());
r.setRzhbzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.H_Z_R_B_Z:
r.setHzrzUserTotal(u.getTotal());
r.setHzrzUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
case UserConstant.Z_B_Q_C:
r.setZbqcUserTotal(u.getTotal());
r.setZbqcUserRatio(getRatio(r.getUserTotal(),u.getTotal()));
break;
default:
break;
}
});
return r;
}
/**
* @Description
* @param total 总人数
* @param fz 分子人数
* @Author zxc
* @Date 2022/11/16 10:12
*/
public BigDecimal getRatio(Integer total,Integer fz){
BigDecimal totalBig = new BigDecimal(total);
BigDecimal fzBig = new BigDecimal(fz);
return fzBig.multiply(NumConstant.ONE_HUNDRED_DECIMAL).divide(totalBig, NumConstant.TWO, BigDecimal.ROUND_HALF_UP);
}
}

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

@ -1402,4 +1402,20 @@
AND ID_CARD = #{idCard}
</select>
<!-- 根据人户状况查询每个类型的人数 -->
<select id="getUserByRenHu" resultType="com.epmet.dto.result.RHZKStatisticsResultDTO">
SELECT
COUNT(ID) AS total,
rhzk
FROM
(SELECT
ID,
IFNULL(RHZK,'') AS rhzk
FROM ic_resi_user
WHERE DEL_FLAG = '0'
AND `STATUS` = '0'
AND PIDS LIKE CONCAT('%',#{agencyId},'%')) t
GROUP BY rhzk
</select>
</mapper>

Loading…
Cancel
Save