|
|
@ -26,12 +26,14 @@ import com.epmet.constant.UserRedisKeys; |
|
|
|
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; |
|
|
|
import com.epmet.entity.UserBaseInfoEntity; |
|
|
|
import com.epmet.entity.UserWechatEntity; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.util.ModuleConstant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -39,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; |
|
|
@ -61,6 +64,8 @@ public class UserBaseInfoRedis { |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GridLatestDao gridLatestDao; |
|
|
|
@Autowired |
|
|
|
private UserWechatDao userWechatDao; |
|
|
|
|
|
|
|
public void delete(Object[] ids) { |
|
|
|
|
|
|
@ -102,9 +107,11 @@ public class UserBaseInfoRedis { |
|
|
|
} |
|
|
|
//缓存中没有数据,先查数据库,放入缓存后再返回
|
|
|
|
UserBaseInfoResultDTO baseInfo = userBaseInfoDao.selectListByUserIdList(userId); |
|
|
|
|
|
|
|
if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){ |
|
|
|
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId); |
|
|
|
|
|
|
|
//如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士)
|
|
|
|
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId); |
|
|
|
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ |
|
|
|
baseInfo.setCustomerId(relation.getCustomerId()); |
|
|
|
BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO(); |
|
|
@ -140,6 +147,27 @@ public class UserBaseInfoRedis { |
|
|
|
} |
|
|
|
set(baseInfo); |
|
|
|
return baseInfo; |
|
|
|
}else{ |
|
|
|
//如果没有,说明这里是陌生人
|
|
|
|
//陌生人不放入缓存,也不更新用户基础信息表
|
|
|
|
baseInfo = new UserBaseInfoResultDTO(); |
|
|
|
baseInfo.setUserId(userId); |
|
|
|
List<UserWechatEntity> wechatInfo = userWechatDao.selectByUserId(userId); |
|
|
|
if(null != wechatInfo && !wechatInfo.isEmpty()){ |
|
|
|
baseInfo.setNickname(wechatInfo.get(NumConstant.ZERO).getNickname()); |
|
|
|
}else{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserId(userId); |
|
|
|
if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ |
|
|
|
baseInfo.setCustomerId(relation.getCustomerId()); |
|
|
|
}else{ |
|
|
|
LatestGridInfoResultDTO gridLatest = |
|
|
|
gridLatestDao.selectLatestGridInfoByUserId(userId); |
|
|
|
if(null != gridLatest){ |
|
|
|
baseInfo.setCustomerId(gridLatest.getCustomerId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|