| 
						
						
							
								
							
						
						
					 | 
					@ -5,7 +5,6 @@ import cn.afterturn.easypoi.excel.entity.ExportParams; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | 
					 | 
					 | 
					import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.dingtalk.api.request.OapiRobotSendRequest; | 
					 | 
					 | 
					import com.dingtalk.api.request.OapiRobotSendRequest; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.dynamic.datasource.annotation.DataSource; | 
					 | 
					 | 
					import com.epmet.commons.dynamic.datasource.annotation.DataSource; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.Constant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.Constant; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -18,6 +17,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.RedisKeys; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.RedisKeys; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.RedisUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.RedisUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -27,11 +27,12 @@ import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.EpmetRequestHolder; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.HttpClientManager; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.HttpClientManager; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.constant.DataSourceConstant; | 
					 | 
					 | 
					import com.epmet.dataaggre.constant.DataSourceConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dataaggre.constant.OrgConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dao.govorg.*; | 
					 | 
					 | 
					import com.epmet.dataaggre.dao.govorg.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.datastats.result.SubAgencyProjectResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -41,7 +42,7 @@ import com.epmet.dataaggre.dto.govorg.form.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dto.govorg.result.*; | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.govorg.result.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; | 
					 | 
					 | 
					import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; | 
					 | 
					 | 
					import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import com.epmet.dataaggre.entity.govorg.IcHouseEntity; | 
					 | 
					 | 
					import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.excel.GridLivelyDetailExcel; | 
					 | 
					 | 
					import com.epmet.dataaggre.excel.GridLivelyDetailExcel; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.excel.GridLivelyExcel; | 
					 | 
					 | 
					import com.epmet.dataaggre.excel.GridLivelyExcel; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.service.commonservice.AreaCodeService; | 
					 | 
					 | 
					import com.epmet.dataaggre.service.commonservice.AreaCodeService; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -49,11 +50,13 @@ import com.epmet.dataaggre.service.datastats.DataStatsService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.service.epmetuser.EpmetUserService; | 
					 | 
					 | 
					import com.epmet.dataaggre.service.epmetuser.EpmetUserService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; | 
					 | 
					 | 
					import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.service.govorg.GovOrgService; | 
					 | 
					 | 
					import com.epmet.dataaggre.service.govorg.GovOrgService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dataaggre.service.govproject.GovProjectService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dataaggre.service.opercrm.CustomerRelation; | 
					 | 
					 | 
					import com.epmet.dataaggre.service.opercrm.CustomerRelation; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.IcNeighborHoodDTO; | 
					 | 
					 | 
					import com.epmet.dto.IcNeighborHoodDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.result.UploadImgResultDTO; | 
					 | 
					 | 
					import com.epmet.dto.result.UploadImgResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.feign.OssFeignClient; | 
					 | 
					 | 
					import com.epmet.feign.OssFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.collections4.CollectionUtils; | 
					 | 
					 | 
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.fileupload.FileItem; | 
					 | 
					 | 
					import org.apache.commons.fileupload.FileItem; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -66,6 +69,7 @@ import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.multipart.commons.CommonsMultipartFile; | 
					 | 
					 | 
					import org.springframework.web.multipart.commons.CommonsMultipartFile; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import javax.annotation.Resource; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import javax.servlet.ServletOutputStream; | 
					 | 
					 | 
					import javax.servlet.ServletOutputStream; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import javax.servlet.http.HttpServletResponse; | 
					 | 
					 | 
					import javax.servlet.http.HttpServletResponse; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.IOException; | 
					 | 
					 | 
					import java.io.IOException; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -117,6 +121,8 @@ public class GovOrgServiceImpl implements GovOrgService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private IcHouseDao houseDao; | 
					 | 
					 | 
					    private IcHouseDao houseDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private IcNeighborhoodDao neighborhoodDao; | 
					 | 
					 | 
					    private IcNeighborhoodDao neighborhoodDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Resource | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private GovProjectService govProjectService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param staffId | 
					 | 
					 | 
					     * @param staffId | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -1130,4 +1136,126 @@ public class GovOrgServiceImpl implements GovOrgService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public List<IcNeighborHoodDTO> neighborhoodsByIds(List<String> neighborhoodIds) { | 
					 | 
					 | 
					    public List<IcNeighborHoodDTO> neighborhoodsByIds(List<String> neighborhoodIds) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return neighborhoodDao.neighborhoodsByIds(neighborhoodIds); | 
					 | 
					 | 
					        return neighborhoodDao.neighborhoodsByIds(neighborhoodIds); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 组织项目统计 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param tokenDto | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param formDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param tokenDto | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param formDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Return {@link PageData < MemberProjectInfoResultDTO>} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Author zhaoqifeng | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Date 2022/7/27 9:43 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public PageData<OrgProjectDetailResultDTO> orgProjectDetailList(TokenDto tokenDto, OrgStatisticsFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<OrgProjectDetailResultDTO> resultList = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (StringUtils.isBlank(formDTO.getAgencyId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (null == staffInfo) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取用户信息失败", "获取用户信息失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            formDTO.setAgencyId(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        CustomerAgencyEntity agencyEntity = customerAgencyDao.selectById(formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        long total = 0; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (OrgConstant.COMMUNITY.equals(agencyEntity.getLevel()) && NumConstant.ONE_STR.equals(formDTO.getType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //获取网格列表
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<CustomerGridEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            wrapper.eq(CustomerGridEntity::getCustomerId, tokenDto.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            wrapper.eq(CustomerGridEntity::getPid, formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            wrapper.last("ORDER BY CONVERT ( GRID_NAME USING gbk ) ASC"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<CustomerGridEntity> gridList = customerGridDao.selectList(wrapper); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //拼装数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(gridList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //统计网格项目数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Map<String, Integer> projectMap = govProjectService.getGridProjectMap(formDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //统计网格关闭项目数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Map<String, Integer> closedMap = govProjectService.getGridClosedProjectMap(formDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //网格员统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Map<String, Integer> memberMap = dataStatsService.getMemberMap(formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                resultList = gridList.stream().map(grid -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    OrgProjectDetailResultDTO dto = new OrgProjectDetailResultDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    dto.setOrgId(grid.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    dto.setOrgName(grid.getGridName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (projectMap.containsKey(grid.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setProjectCount(projectMap.get(grid.getId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (closedMap.containsKey(grid.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setClosedCount(closedMap.get(grid.getId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (memberMap.containsKey(grid.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setMemberCount(memberMap.get(grid.getId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setProjectAve(dto.getProjectCount()/memberMap.get(grid.getId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setClosedAve(dto.getClosedCount()/memberMap.get(grid.getId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return dto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //获取统计数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            PageInfo<CustomerGridEntity> pageInfo = new PageInfo<>(gridList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            total = pageInfo.getTotal(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //获取组织列表
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<CustomerAgencyEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            wrapper.eq(CustomerAgencyEntity::getCustomerId, tokenDto.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (NumConstant.ZERO_STR.equals(formDTO.getType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                wrapper.eq(CustomerAgencyEntity::getId, formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                wrapper.eq(CustomerAgencyEntity::getPid, formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            wrapper.last("ORDER BY CONVERT ( ORGANIZATION_NAME USING gbk ) ASC"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<CustomerAgencyEntity> agencyList = customerAgencyDao.selectList(wrapper); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //拼装数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(agencyList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //项目相关统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Map<String, SubAgencyProjectResultDTO> projectMap = dataStatsService.getAgencyProjectTotal(formDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //网格员统计
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Map<String, Integer> memberMap = epmetUserService.getMemberCount(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                resultList = agencyList.stream().map(agency -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    OrgProjectDetailResultDTO dto = new OrgProjectDetailResultDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    dto.setOrgId(agency.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    dto.setOrgName(agency.getOrganizationName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (projectMap.containsKey(agency.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setProjectCount(projectMap.get(agency.getId()).getProjectTotal()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setClosedCount(projectMap.get(agency.getId()).getClosedProjectTotal()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    //获取当前组织的所有下级组织ID(包含本级)
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    List<String> agencyIds = customerAgencyDao.getSubAgencyList(agency.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    //将下级组织网格员数加起来
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    int memberCount = agencyIds.stream().filter(memberMap::containsKey).mapToInt(memberMap::get).sum(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    dto.setMemberCount(memberCount); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (memberCount != NumConstant.ZERO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setProjectAve(dto.getProjectCount()/memberCount); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        dto.setClosedAve(dto.getClosedCount()/memberCount); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return dto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //获取统计数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            PageInfo<CustomerAgencyEntity> pageInfo = new PageInfo<>(agencyList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            total = pageInfo.getTotal(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return new PageData<>(resultList, total); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 网格员项目相关统计 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param tokenDto | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param formDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param tokenDto | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param formDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Return {@link PageData< MemberProjectInfoResultDTO>} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Author zhaoqifeng | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Date 2022/7/27 9:44 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public PageData<MemberProjectInfoResultDTO> memberProjectInfoList(TokenDto tokenDto, OrgStatisticsFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |