Commit f60297b4 authored by “yiyousong”'s avatar “yiyousong”
parents 96d675ac dae8bffc
...@@ -13,6 +13,7 @@ import feign.hystrix.FallbackFactory; ...@@ -13,6 +13,7 @@ import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -71,7 +72,8 @@ public interface IApiModelFeign extends IFeign { ...@@ -71,7 +72,8 @@ public interface IApiModelFeign extends IFeign {
@PostMapping(value = "model/census/list/bySite") @PostMapping(value = "model/census/list/bySite")
String getModelCensusBySiteId(@RequestBody ModelPdu query); String getModelCensusBySiteId(@RequestBody ModelPdu query);
@GetMapping(value = "site/siteTree")
String siteTree();
} }
...@@ -132,6 +134,14 @@ class ModelFeignFallbackFactory implements FallbackFactory<IApiModelFeign> { ...@@ -132,6 +134,14 @@ class ModelFeignFallbackFactory implements FallbackFactory<IApiModelFeign> {
return JSON.toJSONString(failResp); return JSON.toJSONString(failResp);
} }
@Override
public String siteTree() {
ApiResp<List<ModelCensusFeignVO>> failResp = new ApiResp<>();
failResp.setCode(ApiRespCodeEnum.FAILED.getValue());
failResp.setMsg("暂时无法获取站点树,请稍后再试!");
return JSON.toJSONString(failResp);
}
@Override @Override
public String getSitesAllInfoByQuery(SitePdu query) { public String getSitesAllInfoByQuery(SitePdu query) {
ApiResp<List<SiteFeignVO>> failResp = new ApiResp<>(); ApiResp<List<SiteFeignVO>> failResp = new ApiResp<>();
......
...@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.resource.service.ResourceService; ...@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService; import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.SitePdu;
import com.mortals.xhx.common.utils.LoginAESUtil; import com.mortals.xhx.common.utils.LoginAESUtil;
import com.mortals.xhx.common.utils.MenuEncodeUtil; import com.mortals.xhx.common.utils.MenuEncodeUtil;
import com.mortals.xhx.feign.model.IApiModelFeign; import com.mortals.xhx.feign.model.IApiModelFeign;
...@@ -108,10 +107,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -108,10 +107,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
data.put("siteList", siteList); data.put("siteList", siteList);
} else { } else {
if (StringUtils.isNotEmpty(userEntity.getAreaCodes())) { if (StringUtils.isNotEmpty(userEntity.getAreaCodes())) {
SitePdu sitePdu = new SitePdu(); String resp = apiModelFeign.siteTree();
List<String> areaCodeList = Arrays.asList(userEntity.getAreaCodes().split(","));
sitePdu.setAreaCodeList(areaCodeList);
String resp = apiModelFeign.getSitesByQuery(sitePdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class); ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) { if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg()); throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment