Commit 7b4e5ee7 authored by “yiyousong”'s avatar “yiyousong”
parents 84624a63 868a1b54
......@@ -16,6 +16,7 @@ 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.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
......@@ -73,7 +74,7 @@ public interface IApiModelFeign extends IFeign {
String getModelCensusBySiteId(@RequestBody ModelPdu query);
@GetMapping(value = "site/siteTree")
String siteTree();
String siteTree(@RequestHeader("Authorization") String authorization);
}
......@@ -135,7 +136,7 @@ class ModelFeignFallbackFactory implements FallbackFactory<IApiModelFeign> {
}
@Override
public String siteTree() {
public String siteTree(@RequestHeader("Authorization") String authorization) {
ApiResp<List<ModelCensusFeignVO>> failResp = new ApiResp<>();
failResp.setCode(ApiRespCodeEnum.FAILED.getValue());
failResp.setMsg("暂时无法获取站点树,请稍后再试!");
......
......@@ -15,6 +15,7 @@ import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.code.YesNoEnum;
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.MenuEncodeUtil;
import com.mortals.xhx.feign.model.IApiModelFeign;
......@@ -107,13 +108,16 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
data.put("siteList", siteList);
} else {
if (StringUtils.isNotEmpty(userEntity.getAreaCodes())) {
String resp = apiModelFeign.siteTree();
SitePdu sitePdu = new SitePdu();
List<String> areaCodeList = Arrays.asList(userEntity.getAreaCodes().split(","));
sitePdu.setAreaCodeList(areaCodeList);
String resp = apiModelFeign.siteTree(token);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg());
}
if (apiResp.getData().get("data") != null) {
data.put("siteList", apiResp.getData().get("data"));
if (apiResp.getData().get("siteTree") != null) {
data.put("siteList", apiResp.getData().get("siteTree"));
} else {
data.put("siteList", Collections.emptyList());
}
......
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