Commit a9abcb47501cadba3c862c6c842ca0bf06fa451e

Authored by rui.zhang
1 parent 4359d8a570

bug fix

机构类型 返回时设置orgType
    机构列表当用户没有机构时

Showing 3 changed files with 44 additions and 14 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java View file @ a9abcb4
1 1 package com.lyms.platform.permission.service.impl;
2 2  
  3 +import com.lyms.platform.common.enums.OrganizationTypeEnum;
3 4 import com.lyms.platform.permission.dao.OrganizationMapper;
4 5 import com.lyms.platform.permission.model.Organization;
5 6 import com.lyms.platform.permission.model.OrganizationQuery;
6 7 import com.lyms.platform.permission.service.OrganizationService;
  8 +import org.apache.commons.collections.CollectionUtils;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.stereotype.Service;
9 11  
  12 +import java.util.Collections;
10 13 import java.util.List;
11 14  
12 15 @Service
... ... @@ -32,7 +35,16 @@
32 35  
33 36 @Override
34 37 public Organization getOrganization(Integer id) {
35   - return organizationMapper.getOrganization(id);
  38 + Organization organization = organizationMapper.getOrganization(id);
  39 + //设置机构类型 0 公司 1 医院
  40 + if(null != organization.getType() &&
  41 + (organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) ||
  42 + organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) {
  43 + organization.setOrgType(1);
  44 + } else {
  45 + organization.setOrgType(0);
  46 + }
  47 + return organization;
36 48 }
37 49  
38 50 @Override
... ... @@ -45,7 +57,20 @@
45 57 if (query.getNeed() != null) {
46 58 query.mysqlBuild(organizationMapper.queryOrganizationCount(query));
47 59 }
48   - return organizationMapper.queryOrganization(query);
  60 + List<Organization> organizations = organizationMapper.queryOrganization(query);
  61 + if(CollectionUtils.isNotEmpty(organizations)) {
  62 + for(Organization organization : organizations) {
  63 + //设置机构类型 0 公司 1 医院
  64 + if(null != organization.getType() &&
  65 + (organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) ||
  66 + organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) {
  67 + organization.setOrgType(1);
  68 + } else {
  69 + organization.setOrgType(0);
  70 + }
  71 + }
  72 + }
  73 + return organizations;
49 74 }
50 75  
51 76 public List<String> queryProvinceIdByOrgId(List<Integer> orgId) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java View file @ a9abcb4
... ... @@ -233,10 +233,11 @@
233 233 @RequestParam(value = "keyword", required = false) String keyword,
234 234 @RequestParam(value = "areaId", required = false) String aId) {
235 235 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  236 + Users users = usersService.getUsers(loginState.getId());
236 237  
237 238 List<Integer> areaId = autoMatchFacade.matchOrgId(loginState.getId());
238 239 List<Object> data = new ArrayList<>();
239   - List<Organization> organizations;
  240 + List<Organization> organizations = new ArrayList<>();
240 241 PageInfo pageInfo =null;
241 242 if (CollectionUtils.isNotEmpty(areaId)) {
242 243 OrganizationQuery organizationQuery = new OrganizationQuery();
... ... @@ -281,7 +282,7 @@
281 282 organizations = organizationService.queryOrganization(organizationQuery);
282 283 pageInfo=organizationQuery.getPageInfo();
283 284  
284   - } else {
  285 + } else if(null == areaId && users.getType().equals(2)){
285 286 // UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery();
286 287 // userOrganizationMapsQuery.setYn(YnEnums.YES.getId());
287 288 // userOrganizationMapsQuery.setUserId(loginState.getId());
... ... @@ -340,15 +341,6 @@
340 341 }
341 342 if (null != organization.getStreetId()) {
342 343 organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()), true));
343   - }
344   -
345   - //设置机构类型 0 公司 1 医院
346   - if(null != organization.getType() &&
347   - (organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) ||
348   - organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) {
349   - organization.setOrgType(1);
350   - } else {
351   - organization.setOrgType(0);
352 344 }
353 345  
354 346 data.add(organization);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java View file @ a9abcb4
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.platform.common.annotation.TokenRequired;
5 5 import com.lyms.platform.common.base.BaseController;
6 6 import com.lyms.platform.common.base.LoginContext;
  7 +import com.lyms.platform.common.base.PageInfo;
7 8 import com.lyms.platform.common.constants.ConstantInterface;
8 9 import com.lyms.platform.common.constants.ErrorCodeConstants;
9 10 import com.lyms.platform.common.enums.YnEnums;
... ... @@ -125,7 +126,14 @@
125 126  
126 127 List<Integer> ids = null;
127 128 if(u.getType().equals(1)) {
128   - orgId = u.getOrgId();
  129 + if(null != u.getOrgId()) {
  130 + orgId = u.getOrgId();
  131 + } else {
  132 + FrontEndResult frontEndResult = new FrontEndResult();
  133 + frontEndResult.setPageInfo(new PageInfo(0,0,0,10));
  134 + frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  135 + return frontEndResult;
  136 + }
129 137 }else if(u.getType().equals(0)) {
130 138 List<Organization> organizations = accessPermissionFacade.findAccessPerminssionByUserId(u.getId());
131 139 ids = new ArrayList<>();
... ... @@ -133,6 +141,11 @@
133 141 for(Organization organization : organizations) {
134 142 ids.add(organization.getId());
135 143 }
  144 + } else {
  145 + FrontEndResult frontEndResult = new FrontEndResult();
  146 + frontEndResult.setPageInfo(new PageInfo(0,0,0,10));
  147 + frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  148 + return frontEndResult;
136 149 }
137 150 }
138 151