Browse Source

导出返回错误信息

release
jianjun 3 years ago
parent
commit
e387fca7de
  1. 3
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateServiceImpl.java
  2. 29
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  3. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

3
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.IcExportItemListFormDTO;
import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@ -203,7 +204,7 @@ public class IcExportTemplateServiceImpl extends BaseServiceImpl<IcExportTemplat
}
if (CollectionUtils.isEmpty(list)) {
return null;
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"模板配置错误,请确认模板是否存在!","模板配置错误,请确认模板是否存在!");
}
Map<String, List<IcExportTemplateForExportResultDTO>> resultTemp = list.stream()

29
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -78,10 +78,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
@ -415,13 +412,23 @@ public class IcResiUserController implements ResultDataResolver {
@NoRepeatSubmit
@RequestMapping(value = "/exportExcelCustom")
public void exportExcelCustom(@LoginUser TokenDto tokenDto, @RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception {
//获取导出配置
String aDefault = tokenDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat("default");
if (pageFormDTO.getTemplateId().equals(aDefault)){
log.info("通过原来的模板下载,tokenDto:{}", JSON.toJSONString(tokenDto));
this.exportExcelByEasyExcel(tokenDto,pageFormDTO.getSearchForm(),response);
}else{
icResiUserExportService.exportIcResiUser(tokenDto,pageFormDTO,response);
try {
//获取导出配置
String aDefault = tokenDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat("default");
if (pageFormDTO.getTemplateId().equals(aDefault)){
log.info("通过原来的模板下载,tokenDto:{}", JSON.toJSONString(tokenDto));
this.exportExcelByEasyExcel(tokenDto,pageFormDTO.getSearchForm(),response);
}else{
icResiUserExportService.exportIcResiUser(tokenDto,pageFormDTO,response);
}
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setHeader("content-type", "text/htm1; charset=UTF-8");
PrintWriter printWriter = response.getWriter();
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg());
printWriter.write(JSON.toJSONString(result));
printWriter.close();
}
}
/**

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

@ -73,6 +73,11 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
@Autowired
private IcResiUserImportService icResiUserImportService;
/**
* key:itemId,value: key:columnName,中文
*/
private static Map<String, Cache<String, String>> remoteOptionCacheMap = new HashMap<>();
/**
* desc: 根据条件查询居民信息并根据配置模板导出
*
@ -231,9 +236,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
param.setTempId(templateId);
param.setExportConfig(exportConfig);
Result<IcCustomExportResultDTO> exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param);
if (!exportConfigResult.success() || exportConfigResult.getData() == null) {
log.error("获取模板失败,internalMsg:{},msg:{}" + exportConfigResult.getInternalMsg(), exportConfigResult.getMsg());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取模板失败" + exportConfigResult.getInternalMsg());
if (!exportConfigResult.success() ) {
log.error("获取模板失败,internalMsg:{},msg:{}" , exportConfigResult.getInternalMsg(), exportConfigResult.getMsg());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取模板失败" + exportConfigResult.getInternalMsg(),"获取模板失败" + exportConfigResult.getInternalMsg());
}
IcCustomExportResultDTO data = exportConfigResult.getData();
@ -245,12 +250,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
return exportConfigResult;
}
/**
* key:itemId,value: key:columnName,中文
*/
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) {
try {
Map<String, IcResiUserImportServiceImpl.ColumnWrapper> columnWrappers = new HashMap<>();

Loading…
Cancel
Save