|
|
@ -8,10 +8,14 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.PidUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActTypeDictDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|
|
@ -29,6 +33,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -51,6 +56,9 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD |
|
|
|
@Autowired |
|
|
|
private ResiGroupOpenFeignClient groupOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(String agencyId) { |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); |
|
|
@ -169,10 +177,22 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD |
|
|
|
return l.stream().map(e -> { |
|
|
|
// 查询支部
|
|
|
|
IcPartyOrgEntity branch = icPartyOrgDao.selectById(e.getSszb()); |
|
|
|
// 查询居民信息,用于显示年龄
|
|
|
|
IcResiUserInfoCache resiInfo = CustomerResiUserRedis.getIcResiUserInfo(e.getIcResiUser()); |
|
|
|
|
|
|
|
LingShanScreenPartyOrgTreeResultDTO.Partymember t = new LingShanScreenPartyOrgTreeResultDTO.Partymember(); |
|
|
|
|
|
|
|
String birthDay; |
|
|
|
if (resiInfo != null |
|
|
|
&& StringUtils.isNotBlank(birthDay = resiInfo.getBirthday())) { |
|
|
|
Date birthday = DateUtils.parse(birthDay, DateUtils.DATE_PATTERN); |
|
|
|
Calendar ci = Calendar.getInstance(); |
|
|
|
ci.setTime(birthday); |
|
|
|
int birthYear = ci.get(Calendar.YEAR); |
|
|
|
t.setAge((LocalDate.now().getYear() - birthYear) + ""); |
|
|
|
} |
|
|
|
|
|
|
|
t.setName(e.getName()); |
|
|
|
t.setAge(e.getAgencyId()); |
|
|
|
Integer gender = e.getGender(); |
|
|
|
t.setGender(gender != null ? GenderEnum.getName(gender.toString()) : "未知"); |
|
|
|
t.setOrgname(branch != null ? branch.getPartyOrgName() : null); |
|
|
@ -285,4 +305,19 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD |
|
|
|
|
|
|
|
return rl; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer getPartymemberQtyOfOrg(String agencyId) { |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); |
|
|
|
if (agencyInfo == null) { |
|
|
|
logger.error("getPartymemberQtyOfOrg查询组织信息失败agencyId:{}", agencyId); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询当前组织信息失败,agencyId:" + agencyId, "查询当前组织信息失败"); |
|
|
|
} |
|
|
|
|
|
|
|
LambdaQueryWrapper<IcPartyMemberEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
query.likeRight(IcPartyMemberEntity::getAgencyPids, PidUtils.convertPid2OrgIdPath(agencyId, agencyInfo.getPids())) |
|
|
|
.or() |
|
|
|
.eq(IcPartyMemberEntity::getAgencyId, agencyId); |
|
|
|
return icPartyMemberDao.selectCount(query); |
|
|
|
} |
|
|
|
} |
|
|
|