Commit 20a4250c authored by 廖旭伟's avatar 廖旭伟

恢复用户站点列表接口

parent ec0b50a7
...@@ -156,4 +156,52 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas ...@@ -156,4 +156,52 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
return ret; return ret;
} }
@PostMapping({"site/list"})
public Rest<Object> list() {
IUser user = this.getCurUser();
if (user == null) {
throw new AppException("用户未登录");
}
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询用户站点列表";
int code = 1;
try {
if (StringUtils.isNotEmpty(user.getSiteIds())) {
SitePdu sitePdu = new SitePdu();
List<String> siteIds = Arrays.asList(user.getSiteIds().split(","));
List<Long> idList = new ArrayList<>();
siteIds.forEach(s -> {
idList.add(DataUtil.converStr2Long(s, 0));
});
sitePdu.setIdList(idList);
String resp = iApiBaseManagerFeign.getSitesByQuery(sitePdu);
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) {
model.put("data", apiResp.getData().get("data"));
} else {
model.put("data", Collections.emptyList());
}
} else {
model.put("data", Collections.emptyList());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
} }
\ No newline at end of file
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