|
|
@@ -1,6 +1,7 @@
|
|
|
package com.sckw.system.dubbo;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
@@ -12,6 +13,7 @@ import com.sckw.system.api.model.dto.res.*;
|
|
|
import com.sckw.system.api.model.pojo.DeptInfoPojo;
|
|
|
import com.sckw.system.dao.SysDictDao;
|
|
|
import com.sckw.system.model.*;
|
|
|
+import com.sckw.system.model.vo.res.FindAreaTreeResVo;
|
|
|
import com.sckw.system.service.KwsUserService;
|
|
|
import com.sckw.system.service.SysAreaService;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
@@ -492,4 +494,48 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
|
|
|
return child;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param code 区域code
|
|
|
+ * @return List<FindAreaTreeResVo>
|
|
|
+ * @desc: 查区域树
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/7/31
|
|
|
+ */
|
|
|
+ public List<FindAreaTreeResVo> queryAreaTree(Integer code) {
|
|
|
+ String key = Global.REDIS_GROUP_AREA_PREFIX + code;
|
|
|
+ String areaCache = RedissonUtils.getString(key);
|
|
|
+ if (StringUtils.isBlank(areaCache)) {
|
|
|
+ List<FindAreaTreeResVo> findAreaTreeResVos = queryAreaGroup(code);
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(findAreaTreeResVos), Global.COMMON_EXPIRE);
|
|
|
+ return findAreaTreeResVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ RedissonUtils.putString(key, areaCache, Global.COMMON_EXPIRE);
|
|
|
+ return JSONArray.parseArray(areaCache, FindAreaTreeResVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param code 区域code
|
|
|
+ * @return List<FindAreaTreeResVo>
|
|
|
+ * @desc: 查区域树
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/7/31
|
|
|
+ */
|
|
|
+ private List<FindAreaTreeResVo> queryAreaGroup(Integer code) {
|
|
|
+ Map<String, Object> params = new HashMap<>(1);
|
|
|
+ params.put("pcode", code);
|
|
|
+ List<Map<String, Object>> list = sysAreaService.findList(params);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FindAreaTreeResVo> result = BeanUtils.copyToList(list, FindAreaTreeResVo.class);
|
|
|
+ for (FindAreaTreeResVo findAreaTreeResVo : result) {
|
|
|
+ findAreaTreeResVo.setChild(queryAreaGroup(findAreaTreeResVo.getCode()));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|