Commit 87c5d0f10b289d306898ea6512662c0cb11cda30

Authored by jiangjiazhi
1 parent ee08036b81

增加

Showing 1 changed file with 19 additions and 11 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.java View file @ 87c5d0f
... ... @@ -54,6 +54,8 @@
54 54 ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SYSTEM_ERROR, "not find login user!");
55 55 return;
56 56 }
  57 + BasicConfigQuery query = new BasicConfigQuery();
  58 + query.setYn(YnEnums.YES.getId());
57 59  
58 60 if(user.getType().equals(1)) {
59 61 if(null == user.getOrgId()) {
60 62  
61 63  
62 64  
63 65  
64 66  
... ... @@ -61,28 +63,34 @@
61 63 return;
62 64 }
63 65 Organization organization = organizationService.getOrganization(user.getOrgId());
64   - if(null != organization.getStreetId()) {
65   - parentId = organization.getStreetId();
66   - } else if(null != organization.getAreaId()) {
67   - parentId = organization.getAreaId();
68   - } else if(null != organization.getCityId()) {
69   - parentId = organization.getCityId();
70   - } else if (null != organization.getProvinceId()) {
  66 + if (null != organization.getProvinceId() && null==parentId) {
71 67 parentId = organization.getProvinceId();
  68 + query.setId(parentId);
  69 + }else if(StringUtils.isNotEmpty(organization.getCityId())&&null!=parentId &&parentId.equals(organization.getProvinceId())) {
  70 + parentId = organization.getCityId();
  71 + query.setId(parentId);
  72 + }else if(StringUtils.isNotEmpty(organization.getAreaId())&&null!=parentId &&parentId.equals(organization.getCityId())) {
  73 + parentId = organization.getAreaId();
  74 + query.setId(parentId);
72 75 }
  76 + else if(StringUtils.isNotEmpty(organization.getStreetId())&&null!=parentId &&parentId.equals(organization.getAreaId())) {
  77 + parentId = organization.getStreetId();
  78 + query.setId(parentId);
  79 + }else {
  80 + query.setParentId(parentId);
  81 + }
73 82 }
74 83  
75 84  
76 85 if (user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) {
77 86 parentId = SystemConfig.CHINA_BASIC_ID;
  87 + query.setParentId(parentId);
78 88 }
79 89  
80   - BasicConfigQuery query = new BasicConfigQuery();
81   - query.setYn(YnEnums.YES.getId());
82   - query.setParentId(parentId);
  90 +
83 91 List<BasicConfig> configList = basicConfigService.queryBasicConfig(query);
84 92 List<Map<String,Object>> list =new ArrayList<Map<String, Object>>();
85   - if(CollectionUtils.isNotEmpty(configList)){
  93 + if (CollectionUtils.isNotEmpty(configList)){
86 94 for (BasicConfig config :configList){
87 95 Map<String,Object> region=new HashMap<String, Object>();
88 96 region.put("id",config.getId());