|
|
@@ -13,8 +13,10 @@ import com.sckw.system.api.model.pojo.DeptInfoPojo;
|
|
|
import com.sckw.system.dao.SysDictDao;
|
|
|
import com.sckw.system.model.KwsEnterprise;
|
|
|
import com.sckw.system.model.KwsUser;
|
|
|
+import com.sckw.system.model.SysArea;
|
|
|
import com.sckw.system.model.SysDict;
|
|
|
import com.sckw.system.service.KwsUserService;
|
|
|
+import com.sckw.system.service.SysAreaService;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -40,6 +42,9 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
|
|
|
@Autowired
|
|
|
private RemoteBaseService remoteBaseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysAreaService sysAreaService;
|
|
|
+
|
|
|
/**
|
|
|
* @param type 类型
|
|
|
* @return SysDictResDto
|
|
|
@@ -298,6 +303,24 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
|
|
|
return userCacheResDtos.stream().collect(Collectors.groupingBy(UserCacheResDto::getId));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public SysAreaCacheResDto queryAreaCacheById(Integer id) {
|
|
|
+ String key = Global.REDIS_AREA_PREFIX + id;
|
|
|
+ String areaCache = RedissonUtils.getString(key);
|
|
|
+ //从redis查,查不到从数据库查,并写入redis
|
|
|
+ if (StringUtils.isBlank(areaCache)) {
|
|
|
+ SysArea sysArea = sysAreaService.selectById(id);
|
|
|
+ if (Objects.isNull(sysArea)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ SysAreaCacheResDto sysAreaCacheResDto = BeanUtils.copyProperties(sysArea, SysAreaCacheResDto.class);
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(sysAreaCacheResDto), Global.COMMON_EXPIRE);
|
|
|
+ return sysAreaCacheResDto;
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(areaCache, SysAreaCacheResDto.class);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param id 父id,需要遍历的list
|
|
|
* @return SysDictGroupResDto
|