|
@ -17,11 +17,21 @@ |
|
|
|
|
|
|
|
|
package com.epmet.service.evaluationindex.screen.impl; |
|
|
package com.epmet.service.evaluationindex.screen.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; |
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; |
|
|
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; |
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; |
|
|
|
|
|
import com.epmet.dto.screen.result.TreeResultDTO; |
|
|
|
|
|
import com.epmet.constant.ScreenConstant; |
|
|
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; |
|
|
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 组织机构信息 |
|
|
* 组织机构信息 |
|
@ -30,6 +40,50 @@ import org.springframework.stereotype.Service; |
|
|
* @since v1.0.0 2020-09-22 |
|
|
* @since v1.0.0 2020-09-22 |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCustomerAgencyDao, ScreenCustomerAgencyEntity> implements ScreenCustomerAgencyService { |
|
|
@Slf4j |
|
|
|
|
|
public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ScreenCustomerAgencyDao screenCustomerAgencyDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ScreenCustomerGridDao screenCustomerGridDao; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 根据agencyId,查询所有子级agencyId,【当机关的级别为 community时,所有子级为gridId】 |
|
|
|
|
|
* @param agencyId |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* map.put('机关的级别(level)','community/street/district/city/province') |
|
|
|
|
|
* map.put('agencyId','List<String> 所有子级agencyId') |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2020/9/22 1:39 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public Map<String,Object> selectAllSubAgencyId(String agencyId, String customerId) { |
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<>(16); |
|
|
|
|
|
TreeResultDTO rootAgency = screenCustomerAgencyDao.selectRootAgencyId(customerId,agencyId); |
|
|
|
|
|
if (null == rootAgency){ |
|
|
|
|
|
return new HashMap<>(16); |
|
|
|
|
|
} |
|
|
|
|
|
if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){ |
|
|
|
|
|
List<String> gridIdList = screenCustomerGridDao.selectGridIdByAgencyId(agencyId); |
|
|
|
|
|
resultMap.put(ScreenConstant.LEVEL,ScreenConstant.COMMUNITY); |
|
|
|
|
|
resultMap.put(agencyId,gridIdList); |
|
|
|
|
|
}else { |
|
|
|
|
|
resultMap.put(ScreenConstant.LEVEL,rootAgency.getLevel()); |
|
|
|
|
|
resultMap.put(agencyId,getDepartmentList((ScreenConstant.STR_NULL.equals(rootAgency.getPids())||rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getAgencyId() : rootAgency.getPids().concat(ScreenConstant.ENGLISH_COMMA).concat(rootAgency.getAgencyId()))); |
|
|
|
|
|
} |
|
|
|
|
|
return resultMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<String> getDepartmentList(String subAgencyPids) { |
|
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
|
|
List<TreeResultDTO> subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(subAgencyList)) { |
|
|
|
|
|
subAgencyList.forEach(sub -> { |
|
|
|
|
|
List<String> subAgency = getDepartmentList(sub.getPids() + "," + sub.getAgencyId()); |
|
|
|
|
|
result.addAll(subAgency); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
} |
|
|
} |