Browse Source

不再调用GovOrgOpenFeignClient.getGridNameByGridId,差缓存吧

master
yinzuomei 3 years ago
parent
commit
dfdb3cad0a
  1. 35
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

35
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java

@ -21,14 +21,13 @@ import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.GridLatestDao;
import com.epmet.dao.RegisterRelationDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.result.BelongGridNameResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.RegisterRelationEntity;
@ -126,14 +125,10 @@ public class UserBaseInfoRedis {
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId);
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){
baseInfo.setCustomerId(relation.getCustomerId());
BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO();
gridParam.setGridId(relation.getGridId());
baseInfo.setRegisteredGridId(relation.getGridId());
Result<BelongGridNameResultDTO> gridResult =
govOrgOpenFeignClient.getGridNameByGridId(gridParam);
if(gridResult.success() && null != gridResult.getData()
&& StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){
String gridFullName = gridResult.getData().getBelongsGridName();
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(relation.getGridId());
if (null != gridInfoCache) {
String gridFullName = gridInfoCache.getGridNamePath();
baseInfo.setRegisteredGridName(gridFullName);
StringBuffer buffer = new StringBuffer(baseInfo.getSurname());
switch (baseInfo.getGender()) {
@ -217,14 +212,10 @@ public class UserBaseInfoRedis {
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserIdAndCustomerId(userId,customerId);
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){
baseInfo.setCustomerId(relation.getCustomerId());
BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO();
gridParam.setGridId(relation.getGridId());
baseInfo.setRegisteredGridId(relation.getGridId());
Result<BelongGridNameResultDTO> gridResult =
govOrgOpenFeignClient.getGridNameByGridId(gridParam);
if(gridResult.success() && null != gridResult.getData()
&& StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){
String gridFullName = gridResult.getData().getBelongsGridName();
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(relation.getGridId());
if (null != gridInfoCache) {
String gridFullName = gridInfoCache.getGridNamePath();
baseInfo.setRegisteredGridName(gridFullName);
StringBuffer buffer = new StringBuffer(gridFullName.split(ModuleConstant.DASH)[NumConstant.ONE]).append(ModuleConstant.DASH).append(baseInfo.getSurname());
switch (baseInfo.getGender()) {
@ -309,14 +300,10 @@ public class UserBaseInfoRedis {
//如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士)
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){
currentCache.setCustomerId(relation.getCustomerId());
BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO();
gridParam.setGridId(relation.getGridId());
currentCache.setRegisteredGridId(relation.getGridId());
Result<BelongGridNameResultDTO> gridResult =
govOrgOpenFeignClient.getGridNameByGridId(gridParam);
if(gridResult.success() && null != gridResult.getData()
&& StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())) {
String gridFullName = gridResult.getData().getBelongsGridName();
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(relation.getGridId());
if (null != gridInfoCache) {
String gridFullName = gridInfoCache.getGridNamePath();
currentCache.setRegisteredGridName(gridFullName);
if (StringUtils.isBlank(currentCache.getGender())) {
currentCache.setGender(NumConstant.ZERO_STR);

Loading…
Cancel
Save