|
@@ -1,55 +0,0 @@
|
|
|
-package com.ym.mec.cms.service.impl;
|
|
|
-
|
|
|
-import com.ym.mec.cms.dal.dao.OrganizationDao;
|
|
|
-import com.ym.mec.cms.dal.entity.Organization;
|
|
|
-import com.ym.mec.cms.dal.entity.TenantInfo;
|
|
|
-import com.ym.mec.cms.service.OrganizationService;
|
|
|
-import com.ym.mec.cms.service.TenantInfoService;
|
|
|
-import com.ym.mec.common.dal.BaseDAO;
|
|
|
-import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
-import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organization> implements OrganizationService {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private OrganizationDao organizationDao;
|
|
|
- @Resource
|
|
|
- private TenantInfoService tenantInfoService;
|
|
|
-
|
|
|
- @Override
|
|
|
- public BaseDAO<Integer, Organization> getDAO() {
|
|
|
- return organizationDao;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public String getEmployeeOrgan(Integer userId, String organIds,Boolean isSuper) {
|
|
|
- if(StringUtils.isEmpty(organIds)){
|
|
|
- Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
- TenantInfo tenantInfo = tenantInfoService.get(tenantId);
|
|
|
- //如果是超管,或者是机构管理员,可以查看当前机构所有分部数据
|
|
|
- if(isSuper || (tenantInfo.getUserId() != null && tenantInfo.getUserId().equals(userId))){
|
|
|
- Map<String,Object> param = new HashMap<>();
|
|
|
- param.put("tenantId",tenantId);
|
|
|
- List<Organization> all = this.findAll(param);
|
|
|
- if(all != null && all.size() > 0){
|
|
|
- organIds = StringUtils.join(all.stream().map(e->e.getId()).collect(Collectors.toSet()),",");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /*if(StringUtils.isEmpty(organIds)){
|
|
|
- Employee employee = employeeDao.get(userId);
|
|
|
- organIds = employee.getOrganIdList();
|
|
|
- }*/
|
|
|
- return organIds;
|
|
|
- }
|
|
|
-}
|