Browse Source

fix: 大屏特殊人群柱状图计算错误

master
wxz 2 years ago
parent
commit
a4c8cc2184
  1. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  2. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanScreenServiceImpl.java
  3. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

10
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.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO;
import com.epmet.entity.IcResiUserEntity;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
@ -470,4 +471,13 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
* @return
*/
IcResiUserEntity getById(String icResiUserId);
/**
* @Description: 根据orgIdPath计算各个组织下的特殊人群数量
* @param orgIdPath:
* @Return java.util.List<com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO>
* @Author: wangxianzhang
* @Date: 2023/5/24 9:27 AM
*/
List<LingShanSpecialCrowdStatsByOrgResultDTO> countSpecialQtyByOrgIdPath(@Param("orgIdPath") List<String> orgIdPath);
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanScreenServiceImpl.java

@ -18,7 +18,6 @@ import com.epmet.entity.*;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.LingShanScreenService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -47,6 +46,9 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcResiUserDao icResiUserDao;
@Override
public List<LingShanSpecialCrowdStatsByOrgResultDTO> specialCrowdStatsCountBySubOrg(String parentAgencyId, String specialType) {
List<SubOrgResDTO> subOrgs = getResultDataOrThrowsException(govOrgOpenFeignClient.subOrgList(parentAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, null);
@ -77,30 +79,31 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD
return t;
}).collect(Collectors.toList());
List<LingShanSpecialCrowdStatsByOrgResultDTO> ol = new ArrayList<>();
if (LingShanSpecialCrowdTypeEnums.AZBJ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
ol.addAll(azbjDao.statsCountsByOrgIds(orgIdPaths));
}
if (LingShanSpecialCrowdTypeEnums.SQJZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
ol.addAll(sqjzDao.statsCountsByOrgIds(orgIdPaths));
}
if (LingShanSpecialCrowdTypeEnums.XFRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
ol.addAll(xfryDao.statsCountsByOrgIds(orgIdPaths));
}
if (LingShanSpecialCrowdTypeEnums.JDRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
ol.addAll(jdryDao.statsCountsByOrgIds(orgIdPaths));
}
if (LingShanSpecialCrowdTypeEnums.JZHZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
ol.addAll(jzhzDao.statsCountsByOrgIds(orgIdPaths));
}
List<LingShanSpecialCrowdStatsByOrgResultDTO> ol = icResiUserDao.countSpecialQtyByOrgIdPath(orgIdPaths);
// List<LingShanSpecialCrowdStatsByOrgResultDTO> ol = new ArrayList<>();
// if (LingShanSpecialCrowdTypeEnums.AZBJ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
// ol.addAll(azbjDao.statsCountsByOrgIds(orgIdPaths));
// }
// if (LingShanSpecialCrowdTypeEnums.SQJZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
// ol.addAll(sqjzDao.statsCountsByOrgIds(orgIdPaths));
// }
// if (LingShanSpecialCrowdTypeEnums.XFRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
// ol.addAll(xfryDao.statsCountsByOrgIds(orgIdPaths));
// }
// if (LingShanSpecialCrowdTypeEnums.JDRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
// ol.addAll(jdryDao.statsCountsByOrgIds(orgIdPaths));
// }
// if (LingShanSpecialCrowdTypeEnums.JZHZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) {
// ol.addAll(jzhzDao.statsCountsByOrgIds(orgIdPaths));
// }
// 开始给rl++
for (LingShanSpecialCrowdStatsByOrgResultDTO o : ol) {
for (LingShanSpecialCrowdStatsByOrgResultDTO r : rl) {
if (o.getOrgIdPath().contains(r.getOrgIdPath())) {
for (LingShanSpecialCrowdStatsByOrgResultDTO qtyData : ol) {
for (LingShanSpecialCrowdStatsByOrgResultDTO subOrg : rl) {
if (qtyData.getOrgIdPath().contains(subOrg.getOrgIdPath())) {
// 如果ol中的数据,orgIdPath包含了这个组织的orgIdPath,说明这条数据就是这个组织的数据,那就++把
r.setQuantity(r.getQuantity() + o.getQuantity());
subOrg.setQuantity(subOrg.getQuantity() + qtyData.getQuantity());
}
}
}

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

@ -1531,4 +1531,18 @@
<select id="getById" parameterType="java.lang.String" resultType="com.epmet.entity.IcResiUserEntity">
select r.* from ic_resi_user r where r.id = #{icResiUserId}
</select>
<!--根据orgIdPath计算各个组织下的特殊人群数量-->
<select id="countSpecialQtyByOrgIdPath"
resultType="com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO">
select count(*) quantity
, r.PIDS orgIdPath
from ic_resi_user r
inner join ic_special s on (s.DEL_FLAG = 0 and r.ID = s.IC_RESI_USER)
where r.DEL_FLAG = 0
and r.PIDS like CONCAT(#{orgIdPath}, '%')
and s.SPECIAL_RQLB is not null
and s.SPECIAL_RQLB != ''
group by r.PIDS
</select>
</mapper>

Loading…
Cancel
Save