|
|
@ -260,6 +260,7 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember |
|
|
|
//@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Async |
|
|
|
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException { |
|
|
|
try { |
|
|
|
List<PartyMemberImportExcel> fileList = new ArrayList<>(); |
|
|
|
PartyMemberImportExcel excel = null; |
|
|
|
ExcelImportResult<IcPartymemberStyleImportExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcPartymemberStyleImportExcel.class); |
|
|
@ -329,7 +330,7 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember |
|
|
|
/*Collections.sort(numList); |
|
|
|
String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "第" + subList + "行未成功!");*/ |
|
|
|
erroeImport(fileList, taskId, tokenDto.getUserId()); |
|
|
|
erroeImport(fileList); |
|
|
|
return; |
|
|
|
} |
|
|
|
List<IcPartymemberStyleImageEntity> imageList = new ArrayList<>(); |
|
|
@ -363,14 +364,19 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember |
|
|
|
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str + "第" + subList + "行未成功!"); |
|
|
|
} |
|
|
|
return new Result().ok(str);*/ |
|
|
|
erroeImport(fileList, taskId, tokenDto.getUserId()); |
|
|
|
String url = erroeImport(fileList); |
|
|
|
upImportTask(url, taskId, tokenDto.getUserId(), true); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("【党员风采信息导入】程序错误"); |
|
|
|
upImportTask(null, taskId, tokenDto.getUserId(), false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 党员风采导入,错误数据生成导入失败文件,修改导入任务为已结束 |
|
|
|
* @Description 党员风采导入,错误数据生成导入失败文件 |
|
|
|
**/ |
|
|
|
private void erroeImport(List<PartyMemberImportExcel> fileList, String importTaskId, String staffId) throws IOException { |
|
|
|
private String erroeImport(List<PartyMemberImportExcel> fileList) throws IOException { |
|
|
|
String url = ""; |
|
|
|
//1.有错误数据则生成错误数据存放文件传到阿里云服务
|
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(fileList)) { |
|
|
@ -409,16 +415,24 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember |
|
|
|
} |
|
|
|
url = uploadResult.getData().getUrl(); |
|
|
|
} |
|
|
|
//2.更新导入任务数据
|
|
|
|
return url; |
|
|
|
} |
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 党员风采导入修改导入任务状态 |
|
|
|
**/ |
|
|
|
private void upImportTask(String url, String importTaskId, String staffId, Boolean status) { |
|
|
|
//更新导入任务数据
|
|
|
|
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); |
|
|
|
importTaskForm.setOperatorId(staffId); |
|
|
|
importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_PARTY_MEMBER); |
|
|
|
importTaskForm.setTaskId(importTaskId); |
|
|
|
importTaskForm.setResultDescFilePath(url); |
|
|
|
if (status && StringUtils.isBlank(url)) { |
|
|
|
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
if (StringUtils.isNotBlank(url)) { |
|
|
|
} else { |
|
|
|
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
importTaskForm.setResultDesc("党员风采导入存在错误数据"); |
|
|
|
importTaskForm.setResultDesc("党员风采导入存在错误"); |
|
|
|
} |
|
|
|
Result result = commonServiceOpenFeignClient.finishImportTask(importTaskForm); |
|
|
|
if (!result.success()) { |
|
|
|