fix: 修改内外部会议政策课题政策法规资料的导入
This commit is contained in:
+161
-132
@@ -247,6 +247,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
try {
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + "/" + fileNameStr));
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件存储失败!");
|
||||
}
|
||||
//解压缩
|
||||
@@ -255,6 +256,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
|
||||
FileUnZip.delete(new File(path + "/" + fileNameStr));
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件解压失败");
|
||||
}
|
||||
//获取文件信息
|
||||
@@ -275,15 +277,17 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
}
|
||||
}
|
||||
if (excelCount > 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入了多个Excel文件");
|
||||
}
|
||||
if (excelCount < 1){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件必须包含一个EXCEL文件");
|
||||
}
|
||||
Workbook workbook = null;
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
@Cleanup
|
||||
InputStream inputStream = new FileInputStream(excelFile);
|
||||
inputStream = new FileInputStream(excelFile);
|
||||
workbook = WorkbookFactory.create(inputStream);
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
@@ -292,21 +296,28 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
if (sheet == null) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("工作表为空");
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<String> headerList = new ArrayList<>();
|
||||
// 获取excel表头
|
||||
Row headerRow = sheet.getRow(1);
|
||||
for (int i = 0; i <= 14; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
try {
|
||||
for (int i = 0; i <= 14; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Result.error("表头读取失败,请严格按照模板文件导入数据");
|
||||
} finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
|
||||
// 判断表头字段是否相同
|
||||
if (!String.join(",",headerList).equals(FieldConvertUtil.exportFieldNamesInsideOutsideMeeting + "," + FieldConvertUtil.exportFieldNamesMeetingTopic)) {
|
||||
try {
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件关闭出错");
|
||||
}
|
||||
//删除原上传文件
|
||||
@@ -334,6 +345,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
Date d = cell.getDateCellValue();
|
||||
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
|
||||
}
|
||||
// 将单元格数据存入Map中
|
||||
@@ -341,6 +353,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
if (cell.getStringCellValue().length() > 500) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
|
||||
}
|
||||
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
|
||||
@@ -352,8 +365,20 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
importDataList.add(rowMap);
|
||||
}
|
||||
if (importDataList.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("您输入的数据为空");
|
||||
}
|
||||
try {
|
||||
workbook.close();
|
||||
inputStream.close();
|
||||
FileUnZip.deleteDir(excelFile);
|
||||
} catch (IOException e) {
|
||||
return Result.error("关闭失败");
|
||||
}finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
|
||||
FileUnZip.delete(excelFile);
|
||||
|
||||
// 获取需要校验的字段
|
||||
List<TsDicType> firstMeetingTypeList = dicTypeService.selectAllDicTypeNameByDicCode("firstMeetingType");
|
||||
@@ -365,146 +390,150 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
|
||||
// InsideOutsideMeeting insideOutsideMeetingDB = null;
|
||||
InsideOutsideMeeting insideOutsideMeeting = new InsideOutsideMeeting();
|
||||
List<MeetingTopic> meetingTopicList = new ArrayList<>();
|
||||
for (Map<String, String> dataMap : importDataList) {
|
||||
String meetingName = dataMap.get("*会议名称");
|
||||
// 如果会议名称为空,则表示该行为会议课题行,是之前会议的会议课题,不提交之前的会议信息。不为空则进入
|
||||
if (StringUtils.isNotBlank(meetingName)) {
|
||||
// 如果计数器大于0,表示进入了新的会议信息中,提交之前的会议信息
|
||||
if (count > 0) {
|
||||
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
|
||||
addMeetingInfo(insideOutsideMeeting);
|
||||
// 初始化会议课题列表
|
||||
meetingTopicList.clear();
|
||||
// 初始化会议对象
|
||||
insideOutsideMeeting = new InsideOutsideMeeting();
|
||||
// 计数器归零
|
||||
count = 0;
|
||||
}
|
||||
insideOutsideMeeting.setMeetingName(meetingName);
|
||||
insideOutsideMeeting.setTopicName(dataMap.get("课题名称"));
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议主办单位"))) {
|
||||
insideOutsideMeeting.setMeetingOrganizer(dataMap.get("*会议主办单位"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议主办单位不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议时间"))) {
|
||||
Date meetingTime = null;
|
||||
try {
|
||||
for (Map<String, String> dataMap : importDataList) {
|
||||
String meetingName = dataMap.get("*会议名称");
|
||||
// 如果会议名称为空,则表示该行为会议课题行,是之前会议的会议课题,不提交之前的会议信息。不为空则进入
|
||||
if (StringUtils.isNotBlank(meetingName)) {
|
||||
// 如果计数器大于0,表示进入了新的会议信息中,提交之前的会议信息
|
||||
if (count > 0) {
|
||||
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
|
||||
addMeetingInfo(insideOutsideMeeting);
|
||||
// 初始化会议课题列表
|
||||
meetingTopicList.clear();
|
||||
// 初始化会议对象
|
||||
insideOutsideMeeting = new InsideOutsideMeeting();
|
||||
// 计数器归零
|
||||
count = 0;
|
||||
}
|
||||
insideOutsideMeeting.setMeetingName(meetingName);
|
||||
insideOutsideMeeting.setTopicName(dataMap.get("课题名称"));
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议主办单位"))) {
|
||||
insideOutsideMeeting.setMeetingOrganizer(dataMap.get("*会议主办单位"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议主办单位不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议时间"))) {
|
||||
Date meetingTime = null;
|
||||
try {
|
||||
meetingTime = sdf.parse(dataMap.get("*会议时间"));
|
||||
insideOutsideMeeting.setMeetingTime(meetingTime);
|
||||
} catch (ParseException e) {
|
||||
return Result.error("第"+ (count+1) +"行会议时间格式必须为年-月-日");
|
||||
}
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议时间不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议地点"))) {
|
||||
insideOutsideMeeting.setMeetingAddress(dataMap.get("*会议地点"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议地点不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*参会人员"))) {
|
||||
insideOutsideMeeting.setParticipants(dataMap.get("*参会人员"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行参会人员不能为空");
|
||||
}
|
||||
String meetingMinutesFileNameStr = dataMap.get("会议纪要");
|
||||
String meetingMinutesFileAtt = null;
|
||||
try {
|
||||
meetingTime = sdf.parse(dataMap.get("*会议时间"));
|
||||
insideOutsideMeeting.setMeetingTime(meetingTime);
|
||||
} catch (ParseException e) {
|
||||
return Result.error("第"+ (count+1) +"行会议时间格式必须为年-月-日");
|
||||
meetingMinutesFileAtt = getFileAtt("会议纪要",meetingMinutesFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议时间不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议地点"))) {
|
||||
insideOutsideMeeting.setMeetingAddress(dataMap.get("*会议地点"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行会议地点不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*参会人员"))) {
|
||||
insideOutsideMeeting.setParticipants(dataMap.get("*参会人员"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行参会人员不能为空");
|
||||
}
|
||||
String meetingMinutesFileNameStr = dataMap.get("会议纪要");
|
||||
String meetingMinutesFileAtt = null;
|
||||
try {
|
||||
meetingMinutesFileAtt = getFileAtt("会议纪要",meetingMinutesFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(meetingMinutesFileAtt)) {
|
||||
insideOutsideMeeting.setMeetingMinutes(meetingMinutesFileAtt);
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议主要内容"))) {
|
||||
insideOutsideMeeting.setMeetingContent(dataMap.get("*会议主要内容"));
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行会议主要内容不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*一级会议分类"))) {
|
||||
if (!firstMeetingTypeNameSet.contains(dataMap.get("*一级会议分类"))){
|
||||
return Result.error("一级会议分类不符合输入要求");
|
||||
if (StringUtils.isNotBlank(meetingMinutesFileAtt)) {
|
||||
insideOutsideMeeting.setMeetingMinutes(meetingMinutesFileAtt);
|
||||
}
|
||||
for (TsDicType tsDicType : firstMeetingTypeList) {
|
||||
if (dataMap.get("*一级会议分类").equals(tsDicType.getDicTypeName())) {
|
||||
insideOutsideMeeting.setFirstMeetingType(tsDicType.getDicTypeCode());
|
||||
if (StringUtils.isNotBlank(dataMap.get("*会议主要内容"))) {
|
||||
insideOutsideMeeting.setMeetingContent(dataMap.get("*会议主要内容"));
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行会议主要内容不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*一级会议分类"))) {
|
||||
if (!firstMeetingTypeNameSet.contains(dataMap.get("*一级会议分类"))){
|
||||
return Result.error("一级会议分类不符合输入要求");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行一级会议分类不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*二级会议分类"))) {
|
||||
if (!secondMeetingTypeNameSet.contains(dataMap.get("*二级会议分类"))){
|
||||
return Result.error("二级会议分类不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : secondMeetingTypeList) {
|
||||
if (dataMap.get("*二级会议分类").equals(tsDicType.getDicTypeName())) {
|
||||
insideOutsideMeeting.setSecondMeetingType(tsDicType.getDicTypeCode());
|
||||
for (TsDicType tsDicType : firstMeetingTypeList) {
|
||||
if (dataMap.get("*一级会议分类").equals(tsDicType.getDicTypeName())) {
|
||||
insideOutsideMeeting.setFirstMeetingType(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行一级会议分类不能为空");
|
||||
}
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行二级会议分类不能为空");
|
||||
}
|
||||
// 会议课题信息
|
||||
MeetingTopic meetingTopic = new MeetingTopic();
|
||||
if (StringUtils.isNotBlank(dataMap.get("*议题名称"))) {
|
||||
meetingTopic.setAgendaName(dataMap.get("*议题名称"));
|
||||
if (StringUtils.isNotBlank(dataMap.get("*二级会议分类"))) {
|
||||
if (!secondMeetingTypeNameSet.contains(dataMap.get("*二级会议分类"))){
|
||||
return Result.error("二级会议分类不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : secondMeetingTypeList) {
|
||||
if (dataMap.get("*二级会议分类").equals(tsDicType.getDicTypeName())) {
|
||||
insideOutsideMeeting.setSecondMeetingType(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return Result.error("第"+ (count+1) +"行二级会议分类不能为空");
|
||||
}
|
||||
// 会议课题信息
|
||||
MeetingTopic meetingTopic = new MeetingTopic();
|
||||
if (StringUtils.isNotBlank(dataMap.get("*议题名称"))) {
|
||||
meetingTopic.setAgendaName(dataMap.get("*议题名称"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行议题名称不能为空");
|
||||
}
|
||||
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
|
||||
String agendaMaterialsFileNameAtt = null;
|
||||
try {
|
||||
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
|
||||
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*汇报人"))) {
|
||||
meetingTopic.setReporter(dataMap.get("*汇报人"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行汇报人不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*汇报单位"))) {
|
||||
meetingTopic.setReportingUnit(dataMap.get("*汇报单位"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行汇报单位不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*议题主要内容"))) {
|
||||
meetingTopic.setAgendaContent(dataMap.get("*议题主要内容"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行议题主要内容不能为空");
|
||||
}
|
||||
meetingTopicList.add(meetingTopic);
|
||||
count++;
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行议题名称不能为空");
|
||||
}
|
||||
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
|
||||
String agendaMaterialsFileNameAtt = null;
|
||||
try {
|
||||
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
|
||||
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*汇报人"))) {
|
||||
// 进入else 表示该行是会议课题行
|
||||
MeetingTopic meetingTopic = new MeetingTopic();
|
||||
meetingTopic.setAgendaName(dataMap.get("议题名称"));
|
||||
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
|
||||
String agendaMaterialsFileNameAtt = null;
|
||||
try {
|
||||
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
|
||||
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
|
||||
}
|
||||
meetingTopic.setReporter(dataMap.get("*汇报人"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行汇报人不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*汇报单位"))) {
|
||||
meetingTopic.setReportingUnit(dataMap.get("*汇报单位"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行汇报单位不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dataMap.get("*议题主要内容"))) {
|
||||
meetingTopic.setAgendaContent(dataMap.get("*议题主要内容"));
|
||||
} else {
|
||||
return Result.error("第"+ (count+1) +"行议题主要内容不能为空");
|
||||
meetingTopicList.add(meetingTopic);
|
||||
count++;
|
||||
}
|
||||
meetingTopicList.add(meetingTopic);
|
||||
count++;
|
||||
} else {
|
||||
// 进入else 表示该行是会议课题行
|
||||
MeetingTopic meetingTopic = new MeetingTopic();
|
||||
meetingTopic.setAgendaName(dataMap.get("议题名称"));
|
||||
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
|
||||
String agendaMaterialsFileNameAtt = null;
|
||||
try {
|
||||
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
|
||||
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
|
||||
}
|
||||
meetingTopic.setReporter(dataMap.get("*汇报人"));
|
||||
meetingTopic.setReportingUnit(dataMap.get("*汇报单位"));
|
||||
meetingTopic.setAgendaContent(dataMap.get("*议题主要内容"));
|
||||
meetingTopicList.add(meetingTopic);
|
||||
count++;
|
||||
}
|
||||
// 插入最后一条记录
|
||||
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
|
||||
addMeetingInfo(insideOutsideMeeting);
|
||||
} finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
// 插入最后一条记录
|
||||
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
|
||||
addMeetingInfo(insideOutsideMeeting);
|
||||
return Result.success("导入完成");
|
||||
}
|
||||
|
||||
|
||||
+94
-73
@@ -423,12 +423,14 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
|
||||
FileUnZip.delete(new File(path + "/" + fileNameStr));
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件解压失败");
|
||||
}
|
||||
//获取文件信息
|
||||
List<File> fileList = readImpExcelFile(zipEntryName);
|
||||
//判断获取到的文件数量
|
||||
if (fileList.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("上传的文件不能为空");
|
||||
}
|
||||
File excelFile = null;
|
||||
@@ -443,9 +445,11 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
}
|
||||
}
|
||||
if (excelCount > 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入了多个Excel文件");
|
||||
}
|
||||
if (excelCount < 1){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件必须包含一个EXCEL文件");
|
||||
}
|
||||
Workbook workbook = null;
|
||||
@@ -464,8 +468,14 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
List<String> headerList = new ArrayList<>();
|
||||
// 获取excel表头
|
||||
Row headerRow = sheet.getRow(1);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
try {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Result.error("表头读取失败,请严格按照模板文件导入数据");
|
||||
} finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
|
||||
// 判断表头字段是否相同
|
||||
@@ -499,6 +509,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
Date d = cell.getDateCellValue();
|
||||
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
|
||||
}
|
||||
// 将单元格数据存入Map中
|
||||
@@ -506,6 +517,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
if (cell.getStringCellValue().length() > 500) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
|
||||
}
|
||||
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
|
||||
@@ -517,13 +529,17 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
importDataList.add(rowMap);
|
||||
}
|
||||
if (importDataList.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("您输入的数据为空");
|
||||
}
|
||||
ImportParams importParams = new ImportParams();
|
||||
importParams.setTitleRows(1);
|
||||
@Cleanup
|
||||
// @Cleanup
|
||||
InputStream inputStream = new FileInputStream(excelFile);
|
||||
List<SarLawsInformation> sarLawsInformationList = ExcelImportUtil.importExcel(inputStream, SarLawsInformation.class, importParams);
|
||||
workbook.close();
|
||||
inputStream.close();
|
||||
FileUnZip.delete(excelFile);
|
||||
// 获取需要校验的字段
|
||||
List<TsDicType> firstMaterialTypeList = dicTypeService.selectAllDicTypeNameByDicCode("firstMaterialType");
|
||||
Set<String> firstMaterialTypeNameSet = firstMaterialTypeList.stream().map(TsDicType::getDicTypeName).collect(Collectors.toSet());
|
||||
@@ -542,89 +558,94 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
|
||||
sarLawsInformationListNew.add(sarLawsInformation);
|
||||
}
|
||||
}
|
||||
// if (sarLawsInformationListNew.size() < 1) {
|
||||
// return Result.error("您输入的数据为空");
|
||||
// }
|
||||
for (SarLawsInformation sarLawsInformation : sarLawsInformationListNew){
|
||||
if (StringUtils.isBlank(sarLawsInformation.getDepartment())) {
|
||||
return Result.error("第" + index + "条记录的资料归属部门不能为空");
|
||||
}
|
||||
// 把excel表中的类别名转换为类别编号,并对类别名做检测
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getFirstTypeName())) {
|
||||
List<String> firstTypeCodeList = new ArrayList<>();
|
||||
for (String firstTypeName : sarLawsInformation.getFirstTypeName().split(",")) {
|
||||
if (!firstMaterialTypeNameSet.contains(firstTypeName)){
|
||||
return Result.error("第" + index + "条记录的一级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : firstMaterialTypeList) {
|
||||
if (firstTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
firstTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
if (sarLawsInformationListNew.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("您输入的数据为空");
|
||||
}
|
||||
try {
|
||||
for (SarLawsInformation sarLawsInformation : sarLawsInformationListNew){
|
||||
if (StringUtils.isBlank(sarLawsInformation.getDepartment())) {
|
||||
return Result.error("第" + index + "条记录的资料归属部门不能为空");
|
||||
}
|
||||
// 把excel表中的类别名转换为类别编号,并对类别名做检测
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getFirstTypeName())) {
|
||||
List<String> firstTypeCodeList = new ArrayList<>();
|
||||
for (String firstTypeName : sarLawsInformation.getFirstTypeName().split(",")) {
|
||||
if (!firstMaterialTypeNameSet.contains(firstTypeName)){
|
||||
return Result.error("第" + index + "条记录的一级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : firstMaterialTypeList) {
|
||||
if (firstTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
firstTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
sarLawsInformation.setFirstType(String.join(",", firstTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的1级资料分类不能为空");
|
||||
}
|
||||
sarLawsInformation.setFirstType(String.join(",", firstTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的1级资料分类不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getSecondTypeName())) {
|
||||
List<String> secondTypeCodeList = new ArrayList<>();
|
||||
for (String secondTypeName : sarLawsInformation.getSecondTypeName().split(",")) {
|
||||
if (!secondMaterialTypeNameSet.contains(secondTypeName)){
|
||||
return Result.error("第" + index + "条记录的二级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : secondMaterialTypeList) {
|
||||
if (secondTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
secondTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getSecondTypeName())) {
|
||||
List<String> secondTypeCodeList = new ArrayList<>();
|
||||
for (String secondTypeName : sarLawsInformation.getSecondTypeName().split(",")) {
|
||||
if (!secondMaterialTypeNameSet.contains(secondTypeName)){
|
||||
return Result.error("第" + index + "条记录的二级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : secondMaterialTypeList) {
|
||||
if (secondTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
secondTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
sarLawsInformation.setSecondType(String.join(",", secondTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的2级资料分类不能为空");
|
||||
}
|
||||
sarLawsInformation.setSecondType(String.join(",", secondTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的2级资料分类不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getThirdTypeName())) {
|
||||
List<String> thirdTypeCodeList = new ArrayList<>();
|
||||
for (String thirdTypeName : sarLawsInformation.getThirdTypeName().split(",")) {
|
||||
if (!thirdMaterialTypeNameSet.contains(thirdTypeName)){
|
||||
return Result.error("第" + index + "条记录的三级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : thirdMaterialTypeList) {
|
||||
if (thirdTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
thirdTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getThirdTypeName())) {
|
||||
List<String> thirdTypeCodeList = new ArrayList<>();
|
||||
for (String thirdTypeName : sarLawsInformation.getThirdTypeName().split(",")) {
|
||||
if (!thirdMaterialTypeNameSet.contains(thirdTypeName)){
|
||||
return Result.error("第" + index + "条记录的三级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : thirdMaterialTypeList) {
|
||||
if (thirdTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
thirdTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
sarLawsInformation.setThirdType(String.join(",", thirdTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的3级资料分类不能为空");
|
||||
}
|
||||
sarLawsInformation.setThirdType(String.join(",", thirdTypeCodeList));
|
||||
}else {
|
||||
return Result.error("第" + index + "条记录的3级资料分类不能为空");
|
||||
}
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getFourthTypeName())) {
|
||||
List<String> fourthTypeCodeList = new ArrayList<>();
|
||||
for (String fourthTypeName : sarLawsInformation.getFourthTypeName().split(",")) {
|
||||
if (!fourthMaterialTypeNameSet.contains(fourthTypeName)){
|
||||
return Result.error("第" + index + "条记录的四级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : fourthMaterialTypeList) {
|
||||
if (fourthTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
fourthTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getFourthTypeName())) {
|
||||
List<String> fourthTypeCodeList = new ArrayList<>();
|
||||
for (String fourthTypeName : sarLawsInformation.getFourthTypeName().split(",")) {
|
||||
if (!fourthMaterialTypeNameSet.contains(fourthTypeName)){
|
||||
return Result.error("第" + index + "条记录的四级会议类别不符合输入要求");
|
||||
}
|
||||
for (TsDicType tsDicType : fourthMaterialTypeList) {
|
||||
if (fourthTypeName.equals(tsDicType.getDicTypeName())) {
|
||||
fourthTypeCodeList.add(tsDicType.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
sarLawsInformation.setFourthType(String.join(",", fourthTypeCodeList));
|
||||
} else {
|
||||
return Result.error("第" + index + "条记录的4级资料分类不能为空");
|
||||
}
|
||||
sarLawsInformation.setFourthType(String.join(",", fourthTypeCodeList));
|
||||
} else {
|
||||
return Result.error("第" + index + "条记录的4级资料分类不能为空");
|
||||
String informationFileAtt = null;
|
||||
try {
|
||||
informationFileAtt = getFileAtt("资料文件",sarLawsInformation.getInformationFile(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsInformation.setInformationFile(informationFileAtt);
|
||||
// 索引 +1
|
||||
index++;
|
||||
// 存入数据库
|
||||
addLawsInformation(sarLawsInformation);
|
||||
}
|
||||
String informationFileAtt = null;
|
||||
try {
|
||||
informationFileAtt = getFileAtt("资料文件",sarLawsInformation.getInformationFile(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsInformation.setInformationFile(informationFileAtt);
|
||||
// 索引 +1
|
||||
index++;
|
||||
// 存入数据库
|
||||
addLawsInformation(sarLawsInformation);
|
||||
} finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
return Result.success("导入成功");
|
||||
}
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
|
||||
cell.setCellStyle(cellStyle1);
|
||||
}
|
||||
Cell cell = rowHeader.createCell(8);
|
||||
cell.setCellValue("课题组资料");
|
||||
cell.setCellValue("课题组会议");
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(1,1,8,12));
|
||||
cell.setCellStyle(cellStyle1);
|
||||
String exportFieldMeetingName = "会议名称,会议时间,会议地点,参会人员(内部),会议主要内容";
|
||||
|
||||
+136
-114
@@ -265,6 +265,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
try {
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + "/" + fileNameStr));
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件存储失败!");
|
||||
}
|
||||
//解压缩
|
||||
@@ -273,12 +274,14 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
|
||||
FileUnZip.delete(new File(path + "/" + fileNameStr));
|
||||
} catch (IOException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件解压失败");
|
||||
}
|
||||
//获取文件信息
|
||||
List<File> fileList = readImpExcelFile(zipEntryName);
|
||||
//判断获取到的文件数量
|
||||
if (fileList.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("上传的文件不能为空");
|
||||
}
|
||||
File excelFile = null;
|
||||
@@ -293,9 +296,11 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
}
|
||||
}
|
||||
if (excelCount > 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入了多个Excel文件");
|
||||
}
|
||||
if (excelCount < 1){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("文件必须包含一个EXCEL文件");
|
||||
}
|
||||
Workbook workbook = null;
|
||||
@@ -314,31 +319,38 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
// 获取excel表头
|
||||
List<String> headerList = new ArrayList<>();
|
||||
Row headerRow = sheet.getRow(1);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 13; i < 17; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 22; i < 27; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
// 获取关联表表头
|
||||
Row relationRow = sheet.getRow(2);
|
||||
List<String> relationList = new ArrayList<>();
|
||||
for (int i = 8; i < 13; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 17; i < 22; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 27; i < 32; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
List<String> relationList = null;
|
||||
try {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 13; i < 17; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 22; i < 27; i++) {
|
||||
headerList.add(headerRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
// 获取关联表表头
|
||||
Row relationRow = sheet.getRow(2);
|
||||
relationList = new ArrayList<>();
|
||||
for (int i = 8; i < 13; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 17; i < 22; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
for (int i = 27; i < 32; i++) {
|
||||
relationList.add(relationRow.getCell(i).getStringCellValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return Result.error("表头读取失败,请严格按照模板文件导入数据");
|
||||
}finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
|
||||
// 判断表头字段是否相同
|
||||
if (!String.join(",",headerList).equals(FieldConvertUtil.exportFieldLawsTopic)
|
||||
&& !String.join(",",relationList).equals(FieldConvertUtil.exportFieldLawsTopicRelation)) {
|
||||
|| !String.join(",",relationList).equals(FieldConvertUtil.exportFieldLawsTopicRelation)) {
|
||||
try {
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
@@ -370,9 +382,11 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
Date d = cell.getDateCellValue();
|
||||
try {
|
||||
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
|
||||
}
|
||||
// 将单元格数据存入Map中
|
||||
@@ -380,6 +394,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
if (cell.getStringCellValue().length() > 500) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("第"+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
|
||||
}
|
||||
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
|
||||
@@ -391,107 +406,114 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
importDataList.add(rowMap);
|
||||
}
|
||||
if (importDataList.size() < 1) {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("您输入的数据为空");
|
||||
}
|
||||
|
||||
ImportParams importParams = new ImportParams();
|
||||
importParams.setTitleRows(1);
|
||||
importParams.setHeadRows(2);
|
||||
@Cleanup
|
||||
// @Cleanup
|
||||
InputStream inputStream = new FileInputStream(excelFile);
|
||||
List<SarLawsTopicVO> lawsTopicVOList = ExcelImportUtil.importExcel(inputStream, SarLawsTopicVO.class, importParams);
|
||||
excelFile.delete();
|
||||
// 去除空数据
|
||||
int index = 0;
|
||||
for (SarLawsTopicVO lawsTopicVO : lawsTopicVOList) {
|
||||
if (StringUtils.isNotBlank(lawsTopicVO.getTopicName())) {
|
||||
// 存入数据库
|
||||
SarLawsTopic sarLawsTopic = new SarLawsTopic();
|
||||
BeanUtils.copyProperties(lawsTopicVO,sarLawsTopic);
|
||||
if (StringUtils.isBlank(sarLawsTopic.getOrganizer())) {
|
||||
return Result.error("第" + index + "条记录的课题承办单位不能为空");
|
||||
workbook.close();
|
||||
inputStream.close();
|
||||
FileUnZip.delete(excelFile);
|
||||
try{
|
||||
// 去除空数据
|
||||
int index = 1;
|
||||
for (SarLawsTopicVO lawsTopicVO : lawsTopicVOList) {
|
||||
if (StringUtils.isNotBlank(lawsTopicVO.getTopicName())) {
|
||||
// 存入数据库
|
||||
SarLawsTopic sarLawsTopic = new SarLawsTopic();
|
||||
BeanUtils.copyProperties(lawsTopicVO,sarLawsTopic);
|
||||
if (StringUtils.isBlank(sarLawsTopic.getOrganizer())) {
|
||||
return Result.error("第" + index + "条记录的课题承办单位不能为空");
|
||||
}
|
||||
if (sarLawsTopic.getStartTime() == null) {
|
||||
return Result.error("第" + index + "条记录的启动时间不能为空");
|
||||
}
|
||||
if (sarLawsTopic.getStartTime() != null && sarLawsTopic.getCloseTime() != null) {
|
||||
sarLawsTopic.setTopicStatus("已结题");
|
||||
} else {
|
||||
sarLawsTopic.setTopicStatus("进行中");
|
||||
}
|
||||
String agreementFileAtt = null;
|
||||
try {
|
||||
agreementFileAtt = getFileAtt("协议",sarLawsTopic.getAgreement(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setAgreement(agreementFileAtt);
|
||||
String researchPlanFileAtt = null;
|
||||
try {
|
||||
researchPlanFileAtt = getFileAtt("课题组研究方案",sarLawsTopic.getResearchPlan(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchPlan(researchPlanFileAtt);
|
||||
String researchFindingsFileAtt = null;
|
||||
try {
|
||||
researchFindingsFileAtt = getFileAtt("课题组研究成果",sarLawsTopic.getResearchFindings(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchFindings(researchFindingsFileAtt);
|
||||
String researchGroupOtherFileAtt = null;
|
||||
try {
|
||||
researchGroupOtherFileAtt = getFileAtt("课题组其他",sarLawsTopic.getResearchGroupOther(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchGroupOther(researchGroupOtherFileAtt);
|
||||
String conferenceMaterialsFileAtt = null;
|
||||
try {
|
||||
conferenceMaterialsFileAtt = getFileAtt("课题组会议资料",sarLawsTopic.getConferenceMaterials(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setConferenceMaterials(conferenceMaterialsFileAtt);
|
||||
String insideProjectProposalRepostFileAtt = null;
|
||||
try {
|
||||
insideProjectProposalRepostFileAtt = getFileAtt("内部立项报告",sarLawsTopic.getInsideProjectProposalRepost(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideProjectProposalRepost(insideProjectProposalRepostFileAtt);
|
||||
String insideResearchPlanFileAtt = null;
|
||||
try {
|
||||
insideResearchPlanFileAtt = getFileAtt("内部研究方案",sarLawsTopic.getInsideResearchPlan(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideResearchPlan(insideResearchPlanFileAtt);
|
||||
String insideConferenceMaterialsFileAtt = null;
|
||||
try {
|
||||
insideConferenceMaterialsFileAtt = getFileAtt("内部会议资料",sarLawsTopic.getInsideConferenceMaterials(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideConferenceMaterials(insideConferenceMaterialsFileAtt);
|
||||
String insideResearchFindingsFileAtt = null;
|
||||
try {
|
||||
insideResearchFindingsFileAtt = getFileAtt("内部研究成果",sarLawsTopic.getInsideResearchFindings(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideResearchFindings(insideResearchFindingsFileAtt);
|
||||
String insideOtherFileAtt = null;
|
||||
try {
|
||||
insideOtherFileAtt = getFileAtt("内部其他",sarLawsTopic.getInsideOther(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideOther(insideOtherFileAtt);
|
||||
addLawsTopicInfo(sarLawsTopic);
|
||||
}
|
||||
if (sarLawsTopic.getStartTime() == null) {
|
||||
return Result.error("第" + index + "条记录的启动时间不能为空");
|
||||
}
|
||||
if (sarLawsTopic.getStartTime() != null && sarLawsTopic.getCloseTime() != null) {
|
||||
sarLawsTopic.setTopicStatus("已结题");
|
||||
} else {
|
||||
sarLawsTopic.setTopicStatus("进行中");
|
||||
}
|
||||
String agreementFileAtt = null;
|
||||
try {
|
||||
agreementFileAtt = getFileAtt("协议",sarLawsTopic.getAgreement(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setAgreement(agreementFileAtt);
|
||||
String researchPlanFileAtt = null;
|
||||
try {
|
||||
researchPlanFileAtt = getFileAtt("课题组研究方案",sarLawsTopic.getResearchPlan(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchPlan(researchPlanFileAtt);
|
||||
String researchFindingsFileAtt = null;
|
||||
try {
|
||||
researchFindingsFileAtt = getFileAtt("课题组研究成果",sarLawsTopic.getResearchFindings(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchFindings(researchFindingsFileAtt);
|
||||
String researchGroupOtherFileAtt = null;
|
||||
try {
|
||||
researchGroupOtherFileAtt = getFileAtt("课题组其他",sarLawsTopic.getResearchGroupOther(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setResearchGroupOther(researchGroupOtherFileAtt);
|
||||
String conferenceMaterialsFileAtt = null;
|
||||
try {
|
||||
conferenceMaterialsFileAtt = getFileAtt("课题组会议资料",sarLawsTopic.getConferenceMaterials(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setConferenceMaterials(conferenceMaterialsFileAtt);
|
||||
String insideProjectProposalRepostFileAtt = null;
|
||||
try {
|
||||
insideProjectProposalRepostFileAtt = getFileAtt("内部立项报告",sarLawsTopic.getInsideProjectProposalRepost(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideProjectProposalRepost(insideProjectProposalRepostFileAtt);
|
||||
String insideResearchPlanFileAtt = null;
|
||||
try {
|
||||
insideResearchPlanFileAtt = getFileAtt("内部研究方案",sarLawsTopic.getInsideResearchPlan(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideResearchPlan(insideResearchPlanFileAtt);
|
||||
String insideConferenceMaterialsFileAtt = null;
|
||||
try {
|
||||
insideConferenceMaterialsFileAtt = getFileAtt("内部会议资料",sarLawsTopic.getInsideConferenceMaterials(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideConferenceMaterials(insideConferenceMaterialsFileAtt);
|
||||
String insideResearchFindingsFileAtt = null;
|
||||
try {
|
||||
insideResearchFindingsFileAtt = getFileAtt("内部研究成果",sarLawsTopic.getInsideResearchFindings(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideResearchFindings(insideResearchFindingsFileAtt);
|
||||
String insideOtherFileAtt = null;
|
||||
try {
|
||||
insideOtherFileAtt = getFileAtt("内部其他",sarLawsTopic.getInsideOther(), fileMap, index);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
sarLawsTopic.setInsideOther(insideOtherFileAtt);
|
||||
addLawsTopicInfo(sarLawsTopic);
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}finally {
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
}
|
||||
return Result.success("导入成功");
|
||||
}
|
||||
@@ -676,10 +698,10 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
fileAttList.add(attFileVo.getAttId());
|
||||
}
|
||||
} else {
|
||||
throw new Exception(fieldName + "中第" + (count+1) +"行" + fileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
|
||||
throw new Exception(fieldName + "中第" + (count+1) +"行" + fileName + "文件格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
|
||||
}
|
||||
} else {
|
||||
throw new Exception(fieldName + "中第" + (count+1) +"行" + fileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
|
||||
throw new Exception(fieldName + "中第" + (count+1) +"行" + fileName + "文件格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
|
||||
}
|
||||
}
|
||||
return String.join(",", fileAttList);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FieldConvertUtil {
|
||||
public static String exportFieldLawsInformation = "*1级资料分类,*2级资料分类,*3级资料分类,*4级资料分类,*资料名称,*资料归属部门,作者,资料说明,资料文件";
|
||||
|
||||
// 政策课题 表头
|
||||
public static String exportFieldLawsTopic = "*课题名称,*课题承办单位,课题指导单位,课题参与单位,*启动时间,结题时间,课题费用(万元),协议,课题组会议列表,课题组研究方案,课题组研究成果,课题组其他,课题组会议资料,课题组联系方式,内部立项报告,内部研究方案,内部会议资料,内部研究成果,内部其他,内部联系方式";
|
||||
public static String exportFieldLawsTopic = "*课题名称,*课题承办单位,课题指导单位,课题参与单位,*启动时间,结题时间,课题费用(万元),协议,课题组会议,课题组研究方案,课题组研究成果,课题组其他,课题组会议资料,课题组联系方式,内部立项报告,内部研究方案,内部会议资料,内部研究成果,内部其他,内部联系方式";
|
||||
// 政策课题关联表 表头
|
||||
public static String exportFieldLawsTopicRelation = "会议名称,会议时间,会议地点,参会人员(内部),会议主要内容,姓名,单位,电话,邮箱,身份,姓名,单位,电话,邮箱,身份";
|
||||
|
||||
@@ -104,7 +104,7 @@ public class FieldConvertUtil {
|
||||
"2.所有带*号的字段必须填写\n" +
|
||||
"3.会议分类按照系统中的分类填写\n" +
|
||||
"4.发布日期,企标实施日期字段为年-月-日格式,必须精确到日,例如(2023-04-01)\n" +
|
||||
"5.会议议题如果存在多条,则在下面以此填写,新的内外部会议另起一行填写 \n" +
|
||||
"5.会议议题如果存在多条,则在对应列下依次填写,新的内外部会议另起一行填写 \n" +
|
||||
"6.会议纪要,议题材料为附件文件,需要放在Excel文档同级目录中";
|
||||
|
||||
public static String exportLawsInformationDesc = "填写说明\n" +
|
||||
@@ -117,7 +117,7 @@ public class FieldConvertUtil {
|
||||
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
|
||||
"2.所有带*号的字段必须填写 \n" +
|
||||
"3.启动时间,结题时间字段为年-月-日格式,必须精确到日,例如(2023-12-01)\n" +
|
||||
"4.课题组会议、课题组联系方式、内部联系方式如果存在多条,则在下面一行填写,新的课题组会议、课题组联系方式、内部联系方式在下面依次填写 \n" +
|
||||
"4.课题组会议、课题组联系方式、内部联系方式如果存在多条,则在对应列下依次填写,新的课题组会议、课题组联系方式、内部联系方式在下面依次填写 \n" +
|
||||
"5.协议,研究方案,研究成果,其他,会议资料等为附件文件,需要放在Excel文档同级目录中";
|
||||
|
||||
public static String exportFieldName = "*企标类别,*企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,标准体系,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,";
|
||||
|
||||
Reference in New Issue
Block a user