Commit 3447cc7ba6af05b181a293e838525096f6c05405

Authored by rui.zhang
1 parent ef63116f4b

bug fix

机构分页 空指针

Showing 1 changed file with 49 additions and 1 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java View file @ 3447cc7
... ... @@ -224,7 +224,8 @@
224 224 @TokenRequired
225 225 public FrontEndResult getOrganization(HttpServletRequest request, @RequestParam(value = "page", required = false) Integer page,
226 226 @RequestParam(value = "limit", required = false) Integer limit,
227   - @RequestParam(value = "keyword", required = false) String keyword) {
  227 + @RequestParam(value = "keyword", required = false) String keyword,
  228 + @RequestParam(value = "areaId", required = false) String aId) {
228 229 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
229 230  
230 231 List<Integer> areaId = autoMatchFacade.matchOrgId(loginState.getId());
... ... @@ -240,6 +241,29 @@
240 241 organizationQuery.setSort("province_id desc,city_id desc,area_id desc");
241 242 }
242 243  
  244 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(aId);
  245 + if(null != basicConfig) {
  246 + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) {
  247 + organizationQuery.setProvinceId(aId);
  248 + } else {
  249 + BasicConfig p1 = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
  250 + if (p1 != null && SystemConfig.CHINA_BASIC_ID.equals(p1.getParentId())) {
  251 + organizationQuery.setCityId(aId);
  252 + } else {
  253 + BasicConfig p2 = basicConfigService.getOneBasicConfigById(p1.getParentId());
  254 + if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p2.getParentId())) {
  255 + organizationQuery.setAreaId(aId);
  256 + } else {
  257 +// BasicConfig p3 = basicConfigService.getOneBasicConfigById(p1.getParentId());
  258 +// if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p3.getParentId())) {
  259 + organizationQuery.setStreetId(aId);
  260 +// }
  261 + }
  262 + }
  263 + }
  264 + }
  265 +
  266 +
243 267 organizationQuery.setYn(YnEnums.YES.getId());
244 268 organizationQuery.setIdList(areaId);
245 269 organizationQuery.setKeyword(keyword);
... ... @@ -267,6 +291,30 @@
267 291 organizationQuery.setLimit(limit);
268 292 organizationQuery.setSort("province_id desc,city_id desc,area_id desc");
269 293 }
  294 +
  295 +
  296 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(aId);
  297 + if(null != basicConfig) {
  298 + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) {
  299 + organizationQuery.setProvinceId(aId);
  300 + } else {
  301 + BasicConfig p1 = basicConfigService.getOneBasicConfigById(basicConfig.getParentId());
  302 + if (p1 != null && SystemConfig.CHINA_BASIC_ID.equals(p1.getParentId())) {
  303 + organizationQuery.setCityId(aId);
  304 + } else {
  305 + BasicConfig p2 = basicConfigService.getOneBasicConfigById(p1.getParentId());
  306 + if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p2.getParentId())) {
  307 + organizationQuery.setAreaId(aId);
  308 + } else {
  309 +// BasicConfig p3 = basicConfigService.getOneBasicConfigById(p1.getParentId());
  310 +// if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p3.getParentId())) {
  311 + organizationQuery.setStreetId(aId);
  312 +// }
  313 + }
  314 + }
  315 + }
  316 + }
  317 +
270 318 organizationQuery.setYn(YnEnums.YES.getId());
271 319 organizations = organizationService.queryOrganization(organizationQuery);
272 320 pageInfo = organizationQuery.getPageInfo();