| 
						
						
							
								
							
						
						
					 | 
					@ -4,35 +4,44 @@ import com.alibaba.excel.EasyExcel; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.excel.ExcelWriter; | 
					 | 
					 | 
					import com.alibaba.excel.ExcelWriter; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.excel.write.metadata.WriteSheet; | 
					 | 
					 | 
					import com.alibaba.excel.write.metadata.WriteSheet; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.Constant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.StrConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.FormItemTypeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.IcFormCodeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.user.LoginUserUtil; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ExcelUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ExcelUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.SpringContextUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.constant.IcResiUserConstant; | 
					 | 
					 | 
					import com.epmet.constant.IcResiUserConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.IcExportTemplateQueryFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.IcExportTemplateQueryFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.IcResiUserPageFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.IcResiUserPageFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dto.result.FormItemResult; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.result.IcCustomExportResultDTO; | 
					 | 
					 | 
					import com.epmet.dto.result.IcCustomExportResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dto.result.OptionDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.excel.support.ExportResiUserItemDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.feign.OperCustomizeOpenFeignClient; | 
					 | 
					 | 
					import com.epmet.feign.OperCustomizeOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.IcResiUserExportService; | 
					 | 
					 | 
					import com.epmet.service.IcResiUserExportService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.IcResiUserImportService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.IcResiUserService; | 
					 | 
					 | 
					import com.epmet.service.IcResiUserService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.Page; | 
					 | 
					 | 
					import com.github.pagehelper.Page; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.google.common.cache.Cache; | 
					 | 
					 | 
					import com.google.common.cache.Cache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.google.common.cache.CacheBuilder; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.jetbrains.annotations.Nullable; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import javax.servlet.http.HttpServletResponse; | 
					 | 
					 | 
					import javax.servlet.http.HttpServletResponse; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.IOException; | 
					 | 
					 | 
					import java.io.IOException; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import java.util.ArrayList; | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					import java.util.HashMap; | 
					 | 
					 | 
					import java.util.concurrent.ConcurrentHashMap; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.List; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.Map; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import java.util.stream.Collectors; | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					/** | 
					 | 
					 | 
					/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -48,9 +57,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; | 
					 | 
					 | 
					    private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private LoginUserUtil loginUserUtil; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private IcResiUserService icResiUserService; | 
					 | 
					 | 
					    private IcResiUserService icResiUserService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private IcResiUserImportService icResiUserImportService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * desc: 根据条件查询居民信息并根据配置模板导出 | 
					 | 
					 | 
					     * desc: 根据条件查询居民信息并根据配置模板导出 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -65,22 +74,20 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void exportIcResiUser(IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) { | 
					 | 
					 | 
					    public void exportIcResiUser(IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        ExcelWriter excelWriter = null; | 
					 | 
					 | 
					        ExcelWriter excelWriter = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //获取模板条件
 | 
					 | 
					 | 
					            //获取用户配置的导出条件
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcExportTemplateQueryFormDTO param = new IcExportTemplateQueryFormDTO(); | 
					 | 
					 | 
					            Result<IcCustomExportResultDTO> exportConfigResult = getIcCustomExportConfig(pageFormDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            param.setCustomerId(loginUserUtil.getLoginUserCustomerId()); | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            param.setTempId(pageFormDTO.getTemplateId()); | 
					 | 
					 | 
					            Map<String, ExportResiUserItemDTO> itemOriginMap = getItemMap(pageFormDTO.getCustomerId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					            Result<IcCustomExportResultDTO> exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (!exportConfigResult.success() || exportConfigResult.getData() == null) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                log.error("获取模板失败"); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); | 
					 | 
					 | 
					            IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.info("查询到的模板配置信息:{}", JSON.toJSONString(exportConfigData)); | 
					 | 
					 | 
					            log.info("查询到的模板配置信息:{}", JSON.toJSONString(exportConfigData)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            FreezeAndFilter writeHandler = new FreezeAndFilter(); | 
					 | 
					 | 
					            FreezeAndFilter writeHandler = new FreezeAndFilter(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)).registerWriteHandler(writeHandler).build(); | 
					 | 
					 | 
					            excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)).registerWriteHandler(writeHandler).build(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            WriteSheet writeSheet = EasyExcel.writerSheet().head(exportConfigData.getHeaders()).build(); | 
					 | 
					 | 
					            WriteSheet writeSheet = EasyExcel.writerSheet().head(exportConfigData.getHeaders()).build(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId()); | 
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(pageFormDTO.getCustomerId(), pageFormDTO.getStaffId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (staffInfoCacheResult == null){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取工作人员信息失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String staffOrgPath = null; | 
					 | 
					 | 
					            String staffOrgPath = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { | 
					 | 
					 | 
					            if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()); | 
					 | 
					 | 
					                staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -93,34 +100,54 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            do { | 
					 | 
					 | 
					            do { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String finalStaffOrgPath = staffOrgPath; | 
					 | 
					 | 
					                String finalStaffOrgPath = staffOrgPath; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getIsPage()).doSelectPage(() -> { | 
					 | 
					 | 
					                mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getIsPage()).doSelectPage(() -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    icResiUserService.dynamicQuery(loginUserUtil.getLoginUserCustomerId(), pageFormDTO.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, pageFormDTO.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); | 
					 | 
					 | 
					                    icResiUserService.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, pageFormDTO.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                pageFormDTO.setPageNo(pageFormDTO.getPageNo() + NumConstant.ONE); | 
					 | 
					 | 
					                pageFormDTO.setPageNo(pageFormDTO.getPageNo() + NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<Map<String, Object>> result = mapListPage.getResult(); | 
					 | 
					 | 
					                List<Map<String, Object>> result = mapListPage.getResult(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<List<Object>> resultData = new ArrayList<>(); | 
					 | 
					 | 
					                List<List<Object>> resultData = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                result.forEach(o -> { | 
					 | 
					 | 
					                result.forEach(o -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<Object> singleResult = new ArrayList<>(); | 
					 | 
					 | 
					                    List<Object> singleResult = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    Map<String,Object> originalConditionMap = new ConcurrentHashMap<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    o.forEach((key,value) -> { | 
					 | 
					 | 
					                    o.forEach((key,value) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<IcCustomExportResultDTO.SqlColumn> showSqlColumns = exportConfigData.getShowSqlColumns(); | 
					 | 
					 | 
					                        List<IcCustomExportResultDTO.SqlColumn> showSqlColumns = exportConfigData.getShowSqlColumns(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        Map<String, IcCustomExportResultDTO.SqlColumn> itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); | 
					 | 
					 | 
					                        Map<String, IcCustomExportResultDTO.SqlColumn> itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        if (singleResult.size() < showSqlColumns.size()) { | 
					 | 
					 | 
					                        if (singleResult.size() < showSqlColumns.size()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            singleResult.add(value); | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); | 
					 | 
					 | 
					                            IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            String tableName = sqlColumn.getTableName(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            String itemId = sqlColumn.getItemId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            String columnName = columnDTO.getColumnName(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); | 
					 | 
					 | 
					                            String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                           /* if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { | 
					 | 
					 | 
					                            //保留原始值 便于remote条件获取
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                putRemoteValue(formItemMap.getRemoteItemConditionMap().get(e.getItemId()), currentStaffAgencyId, resiUser,originalConditionMap, e, columnName, vauleStr); | 
					 | 
					 | 
					                            originalConditionMap.putIfAbsent(columnName,vauleStr); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            } else { | 
					 | 
					 | 
					                            ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                putOptionValue(resiUser, e, columnName, vauleStr); | 
					 | 
					 | 
					                            FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            }*/ | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            if (StringUtils.isBlank(vauleStr)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                                return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            String newValue = vauleStr; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                                putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o,originalConditionMap, formItemResult, columnName, vauleStr); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                                newValue = putOptionValue(formItemResult, vauleStr); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            singleResult.add(newValue); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        } | 
					 | 
					 | 
					                        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    }); | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    resultData.add(singleResult); | 
					 | 
					 | 
					                    resultData.add(singleResult); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                log.info("需要写入的data长度:{}", resultData.size()); | 
					 | 
					 | 
					                log.info("需要写入的data长度:{}", resultData.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                excelWriter.write(resultData, writeSheet); | 
					 | 
					 | 
					                excelWriter.write(resultData, writeSheet); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //todo
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } while (mapListPage.getResult().size() == pageFormDTO.getPageSize()); | 
					 | 
					 | 
					            } while (mapListPage.getResult().size() == pageFormDTO.getPageSize()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } catch (IOException e) { | 
					 | 
					 | 
					        } catch (IOException e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.error("exportIcResiUser exception", e); | 
					 | 
					 | 
					            log.error("exportIcResiUser exception", e); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -131,20 +158,31 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Nullable | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public Result<IcCustomExportResultDTO> getIcCustomExportConfig(IcResiUserPageFormDTO pageFormDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        IcExportTemplateQueryFormDTO param = new IcExportTemplateQueryFormDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        param.setCustomerId(pageFormDTO.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        param.setTempId(pageFormDTO.getTemplateId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Result<IcCustomExportResultDTO> exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!exportConfigResult.success() || exportConfigResult.getData() == null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("获取模板失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取模板失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return exportConfigResult; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * key:itemId,value: key:columnName,中文 | 
					 | 
					 | 
					     * key:itemId,value: key:columnName,中文 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private static Map<String, Cache<String,String>> remoteOptionCacheMap = new HashMap<>(); | 
					 | 
					 | 
					    private static Map<String, Cache<String,String>> remoteOptionCacheMap = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    /*private void putRemoteValue(Set<FormItemResult> conditionItemSet, String currentStaffAgencyId, Map<String, Object> map, Map<String, Object> originalConditionMap, FormItemResult e, String columnName, String vauleStr) { | 
					 | 
					 | 
					    private void putRemoteValue(Set<FormItemResult> conditionItemSet, String currentStaffAgencyId, Map<String, Object> map, Map<String, Object> originalConditionMap, FormItemResult e, String columnName, String vauleStr) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>(); | 
					 | 
					 | 
					            Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (e.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ | 
					 | 
					 | 
					            if (e.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                for (FormItemResult o : conditionItemSet) { | 
					 | 
					 | 
					                for (FormItemResult o : conditionItemSet) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    String column = getColumnName(o); | 
					 | 
					 | 
					                    Object conditionValue = originalConditionMap.getOrDefault(columnName, map.get(columnName)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Object conditionValue = originalConditionMap.getOrDefault(column, map.get(column)); | 
					 | 
					 | 
					                    originalConditionMap.putIfAbsent(columnName,conditionValue.toString()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                    originalConditionMap.putIfAbsent(column,conditionValue.toString()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); | 
					 | 
					 | 
					                    IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    value.setColValue(conditionValue.toString()); | 
					 | 
					 | 
					                    value.setColValue(conditionValue.toString()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    columnWrappers.put(o.getItemId(), value); | 
					 | 
					 | 
					                    columnWrappers.put(o.getItemId(), value); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -171,28 +209,67 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } catch (Exception ex) { | 
					 | 
					 | 
					        } catch (Exception ex) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            log.error("listRemoteOptions url:{}", e.getOptionSourceValue()); | 
					 | 
					 | 
					            log.error("listRemoteOptions url", ex); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    private void putOptionValue(Map<String, Object> map, FormItemResult e, String columnName, String vauleStr) { | 
					 | 
					 | 
					    private String putOptionValue(FormItemResult e, String vauleStr) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        FormItemTypeEnum itemTypeEnum = FormItemTypeEnum.getEnum(e.getItemType()); | 
					 | 
					 | 
					        FormItemTypeEnum itemTypeEnum = FormItemTypeEnum.getEnum(e.getItemType()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        switch (itemTypeEnum) { | 
					 | 
					 | 
					        switch (itemTypeEnum) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            case CHECKBOX: | 
					 | 
					 | 
					            case CHECKBOX: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                e.getOptions().forEach(optionDTO -> { | 
					 | 
					 | 
					                for (OptionDTO dto : e.getOptions()) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    map.put(optionDTO.getValue(), vauleStr.contains(optionDTO.getValue()) ? StrConstant.YES : StrConstant.NO); | 
					 | 
					 | 
					                    return vauleStr.contains(dto.getValue()) ? StrConstant.YES : StrConstant.NO; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                break; | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            case SELECT: | 
					 | 
					 | 
					            case SELECT: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            case RADIO: | 
					 | 
					 | 
					            case RADIO: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                e.getOptions().forEach(optionDTO -> { | 
					 | 
					 | 
					                for (OptionDTO optionDTO : e.getOptions()) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    if (optionDTO.getValue().equals(vauleStr)) { | 
					 | 
					 | 
					                    if (optionDTO.getValue().equals(vauleStr)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        map.put(columnName, optionDTO.getLabel()); | 
					 | 
					 | 
					                        return optionDTO.getLabel(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                break; | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            default: | 
					 | 
					 | 
					            default: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    }*/ | 
					 | 
					 | 
					        return vauleStr; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * desc:获取表单配置 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return map key:tableName ,value:ExportResiUserItemDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private Map<String, ExportResiUserItemDTO> getItemMap(String customerId){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //获取表单项
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        IcResiUserService icResiUserService = SpringContextUtils.getBean(IcResiUserService.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (icResiUserService == null){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("获取bean IcResiUserService 失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<FormItemResult> resiFormAllItems = icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, FormItemResult> allItemMap = resiFormAllItems.stream().collect(Collectors.toMap(FormItemResult::getItemId, o -> o)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, ExportResiUserItemDTO> map = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        allItemMap.values().forEach(item->{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            String tableName = item.getTableName(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            ExportResiUserItemDTO exportItem = map.getOrDefault(tableName, new ExportResiUserItemDTO()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            map.putIfAbsent(tableName,exportItem); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            String columnName = item.getColumnName().concat(item.getColumnNum() == NumConstant.ZERO ? StrConstant.EPMETY_STR : item.getColumnNum().toString()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            exportItem.getItemMap().put(columnName,item); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (Constant.OPITON_SOURCE_REMOTE.equals(item.getOptionSourceType())&&item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                //多个参数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                String[] paramArr = item.getOptionSourceValue().split(StrConstant.QUESTION_MARK_TRANSFER)[NumConstant.ONE].split(StrConstant.AND_MARK); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                Arrays.stream(paramArr).forEach(o->{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    FormItemResult value = allItemMap.get(o); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (value == null){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    Set<FormItemResult> conditionSet = exportItem.getRemoteItemConditionMap().getOrDefault(item.getItemId(),new HashSet<>()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    conditionSet.add(value); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    exportItem.getRemoteItemConditionMap().putIfAbsent(item.getItemId(),conditionSet); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return map; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |