|  |  | @ -17,10 +17,12 @@ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.OptionResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.CustomerPartyBranchDao; | 
			
		
	
	
		
			
				
					|  |  | @ -34,14 +36,18 @@ import com.epmet.redis.CustomerPartyBranchRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.CustomerAgencyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.CustomerGridService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.CustomerPartyBranchService; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.Arrays; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Collections; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * 党支部信息 | 
			
		
	
	
		
			
				
					|  |  | @ -49,6 +55,7 @@ import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  |  * @author yinzuomei yinzuomei@elink-cn.com | 
			
		
	
		
			
				
					|  |  |  |  * @since v1.0.0 2020-06-17 | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | @Service | 
			
		
	
		
			
				
					|  |  |  | public class CustomerPartyBranchServiceImpl extends BaseServiceImpl<CustomerPartyBranchDao, CustomerPartyBranchEntity> implements CustomerPartyBranchService { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -134,4 +141,34 @@ public class CustomerPartyBranchServiceImpl extends BaseServiceImpl<CustomerPart | 
			
		
	
		
			
				
					|  |  |  |         baseDao.decrPartyBranchMember(partyBranchId); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 获取网格下支部小组 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param gridId | 
			
		
	
		
			
				
					|  |  |  |      * @Param gridId | 
			
		
	
		
			
				
					|  |  |  |      * @Return {@link List< OptionResultDTO >} | 
			
		
	
		
			
				
					|  |  |  |      * @Author zhaoqifeng | 
			
		
	
		
			
				
					|  |  |  |      * @Date 2021/10/27 9:57 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<OptionResultDTO> getBranchOption(String gridId) { | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isBlank(gridId)) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("网格ID为空"); | 
			
		
	
		
			
				
					|  |  |  |             return Collections.emptyList(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         LambdaQueryWrapper<CustomerPartyBranchEntity> wrapper = new LambdaQueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |         wrapper.eq(CustomerPartyBranchEntity::getGridId, gridId); | 
			
		
	
		
			
				
					|  |  |  |         wrapper.last("ORDER BY CONVERT ( PARTY_BRANCH_NAME USING gbk ) ASC"); | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerPartyBranchEntity> list = baseDao.selectList(wrapper); | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |             return Collections.emptyList(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return list.stream().map(item -> { | 
			
		
	
		
			
				
					|  |  |  |             OptionResultDTO dto = new OptionResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |             dto.setValue(item.getId()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setLabel(item.getPartyBranchName()); | 
			
		
	
		
			
				
					|  |  |  |             return dto; | 
			
		
	
		
			
				
					|  |  |  |         }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } |