Browse Source

【灵山大屏】fix 1.党员列表-年龄错误的问题

master
wxz 3 years ago
parent
commit
5e1ea951da
  1. 22
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/LingShanScreenServiceImpl.java

22
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/LingShanScreenServiceImpl.java

@ -8,10 +8,14 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; 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.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.EpmetRequestHolder;
import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result; 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.IcPartyActDao;
import com.epmet.modules.partyOrg.dao.IcPartyActTypeDictDao; import com.epmet.modules.partyOrg.dao.IcPartyActTypeDictDao;
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -51,6 +56,9 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD
@Autowired @Autowired
private ResiGroupOpenFeignClient groupOpenFeignClient; private ResiGroupOpenFeignClient groupOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override @Override
public List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(String agencyId) { public List<LingShanScreenPartyOrgCategoryResultDTO> listPartyOrgCategoryAndQuantity(String agencyId) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId);
@ -169,10 +177,22 @@ public class LingShanScreenServiceImpl implements LingShanScreenService, ResultD
return l.stream().map(e -> { return l.stream().map(e -> {
// 查询支部 // 查询支部
IcPartyOrgEntity branch = icPartyOrgDao.selectById(e.getSszb()); IcPartyOrgEntity branch = icPartyOrgDao.selectById(e.getSszb());
// 查询居民信息,用于显示年龄
IcResiUserInfoCache resiInfo = CustomerResiUserRedis.getIcResiUserInfo(e.getIcResiUser());
LingShanScreenPartyOrgTreeResultDTO.Partymember t = new LingShanScreenPartyOrgTreeResultDTO.Partymember(); 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.setName(e.getName());
t.setAge(e.getAgencyId());
Integer gender = e.getGender(); Integer gender = e.getGender();
t.setGender(gender != null ? GenderEnum.getName(gender.toString()) : "未知"); t.setGender(gender != null ? GenderEnum.getName(gender.toString()) : "未知");
t.setOrgname(branch != null ? branch.getPartyOrgName() : null); t.setOrgname(branch != null ? branch.getPartyOrgName() : null);

Loading…
Cancel
Save